Jump to content
dadalt95

Trade Signal - extract information

Recommended Posts

Hi!

I want to get the signal in this website:

https://binary-signal.com/pt/chart/eurusd

I have tried using _IEBodyReadText  and some _StringBetween. What happens is that the text are being update every tick and _IEBodyReadText doesn't.

To perform the update I used  _IEAction($oIE, "refresh") but it's not good because the website block me after some time due too many requests..

Is there any other way to get this text every tick?

PS: The text I want to get is WAIT, CALL or PUT.

 

Here is the code:

global $oIE = _IECreate ('https://binary-signal.com/pt/chart/eurusd', 0, 1 , 1 , 0)
Local $sText = _IEBodyReadText($oIE)
$result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')

;MsgBox ( 0, "asf", $result[0])


$espera=StringInStr($result[0], "WAIT")
$compra=StringInStr($result[0], "CALL")
$venda=StringInStr($result[0], "PUT")


;MsgBox($MB_SYSTEMMODAL, "", $espera)

$n=0
$c=0
Captar()






Func Captar()
    ;_IENavigate($oIE, "https://binary-signal.com/pt/chart/eurusd")

    ;MsgBox($MB_SYSTEMMODAL, "", $n)
    Local $sText = _IEBodyReadText($oIE)
    $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')

    If (Not $compra=0) And $n=0 Then
        MsgBox($MB_SYSTEMMODAL, "", "COMPRE")
        $n=1
        $c=$c+1
        ;_IEAction($oIE, "refresh")
        Sleep(60000)
        Captar()

    ElseIf (Not $venda=0) And $n=0 Then
        MsgBox($MB_SYSTEMMODAL, "", "VENDA")
        $c=$c+1
        $n=1
        ;_IEAction($oIE, "refresh")
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        Sleep(60000)
        Captar()


    ElseIf (Not $venda=0) And $n=1 Then
        ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada")
        $n=1
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        ;_IEAction($oIE, "refresh")
        Sleep(60000)
        Captar()

    ElseIf (Not $venda=0) And $n=1 Then
        ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada")
        $n=1
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        ;_IEAction($oIE, "refresh")
        Sleep(60000)
        Captar()


    Else
        ;MsgBox("", "", "ESPERE")
        $n=0
        Sleep(1000)
        ;_IEAction($oIE, "refresh")
        Local $sText = _IEBodyReadText($oIE)
        $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')
        Captar()
    EndIf
EndFunc

 

Share this post


Link to post
Share on other sites

Not it's working!

global $oIE = _IECreate ('https://binary-signal.com/pt/chart/eurusd', 0, 1 , 1 , 0)
Local $sText = _IEBodyReadText($oIE)
$result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')

;MsgBox ( 0, "asf", $result[0])


$espera=StringInStr($result[0], "WAIT")
$compra=StringInStr($result[0], "CALL")
$venda=StringInStr($result[0], "PUT")


;MsgBox($MB_SYSTEMMODAL, "", $espera)

$n=0
$c=0
$i=1


$hstart = _NowCalc()


Captar()






Func Captar()

    ;MsgBox($MB_SYSTEMMODAL, '', "The time is: " & $hstart )
    Local $iDateCalc = _DateDiff('n', $hstart, _NowCalc())


    If $iDateCalc = 1*$i Then  ;depois fazer esse 14 * i
        $i=$i+1
        _IEAction($oIE, "refresh")
        ;MsgBox($MB_SYSTEMMODAL, "", "Number of Hours this year: " & $iDateCalc)

    EndIf




    ;_IENavigate($oIE, "https://binary-signal.com/pt/chart/eurusd")

    ;MsgBox($MB_SYSTEMMODAL, "", $n)
    Local $sText = _IEBodyReadText($oIE)
    $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')
    $espera=StringInStr($result[0], "WAIT")
    $compra=StringInStr($result[0], "CALL")
    $venda=StringInStr($result[0], "PUT")
    ;MsgBox($MB_SYSTEMMODAL, "", $result[0])
    ;MsgBox($MB_SYSTEMMODAL, "", $compra)
    ;MsgBox($MB_SYSTEMMODAL, "", $n)

    If (Not $compra=0) And $n=0 Then
        MsgBox($MB_SYSTEMMODAL, "", "COMPRE")
        $n=1
        $c=$c+1

        Sleep(60000)
        Captar()

    ElseIf (Not $venda=0) And $n=0 Then
        MsgBox($MB_SYSTEMMODAL, "", "VENDA")
        $c=$c+1
        $n=1
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        Sleep(60000)
        Captar()


    ElseIf (Not $compra=0) And $n=1 Then ;;;FAZER COM A MENSAGEM QUE APARECE DE PROFIR OR LOSS
        ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada")
        $n=1
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        Sleep(30000)
        Captar()

    ElseIf (Not $venda=0) And $n=1 Then ;;;FAZER COM A MENSAGEM QUE APARECE DE PROFIR OR LOSS
        ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada")
        $n=1
        ;MsgBox($MB_SYSTEMMODAL, "", $n)
        Sleep(30000)
        Captar()


    Else
        ;MsgBox("", "", "ESPERE")
        $n=0
        ;Sleep(1000)
        Local $sText = _IEBodyReadText($oIE)
        $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA')
        Captar()
    EndIf
EndFunc

The problem now is that is that  I am getting an error:

"C:\Program Files (x86)\AutoIt3\Include\Date.au3" (1220) : ==> Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.:
Local $aDays = [12, 31, (_DateIsLeapYear($iYear) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

I think that error is because I am updating $iDateCalc every tick, is this correct?

Local $iDateCalc = _DateDiff('n', $hstart, _NowCalc())

Share this post


Link to post
Share on other sites

You can do somthing like this:

; Attach to a browser with "AutoIt" in its title, display the URL

#include <IE.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "Terminate")

Global $oIE = _IECreate("https://binary-signal.com/pt/chart/eurusd")

;~ ConsoleWrite(IsObj($oIE) & @CRLF)

Local $oChart = _IEGetObjById($oIE, "chart")
;~ ConsoleWrite(IsObj($oChart) & @CRLF)
Local $oTexts = _IETagNameGetCollection($oChart, "text")
;~ ConsoleWrite(IsObj($oTexts) & @CRLF)

Local $oTextLabel = 0
For $oText In $oTexts
    If StringRegExp(_IEPropertyGet($oText, "outertext"), '\d+.\d+ (WAIT|PUT|CALL)') Then
        $oTextLabel = $oText
        ExitLoop
    EndIf
Next

Local $sTempValue = _IEPropertyGet($oTextLabel, "outertext")
ConsoleWrite("Current Value: " & $sTempValue & @CRLF)

Local $sNewValue = ""
While Sleep(100)
    $sNewValue = _IEPropertyGet($oTextLabel, "outertext")
    If $sNewValue <> $sTempValue Then
        ConsoleWrite("Value Changed: " & $sNewValue & @CRLF)
        $sTempValue = $sNewValue
    EndIf
WEnd


Func Terminate()
    _IEQuit($oIE)
    Exit
EndFunc   ;==>Terminate


Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)
    If Not IsObj($o_object) Then
        __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
    ;
    If Not __IEIsObjType($o_object, "browserdom") Then
        __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    ;
    Local $i_found = 0
    ;
    $o_tags = _IETagNameAllGetCollection($o_object)
    For $o_tag In $o_tags
        If String($o_tag.className) = $s_Class Then
            If ($i_found = $i_index) Then
                SetError($_IEStatus_Success)
                Return $o_tag
            Else
                $i_found += 1
            EndIf
        EndIf
    Next
    ;
    __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class)
    SetError($_IEStatus_NoMatch, 2)
    Return 0
EndFunc   ;==>_IEGetObjByClass

Saludos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By _leo_
      Hey there!
      I am having a problem with clicking a button in IE. As you can see in the code, there would be a class name to click it, but since this button exists several times with exactly the same code, I can only use the "Noch nicht veröffentlicht" to separate it from the others. But this part is just pure text without any classification. 
      "<div class="checkmark" data-v-1e5b1f70=""><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 16 16" data-v-1e5b1f70=""><circle cx="8" cy="8" r="8" data-v-1e5b1f70="" /></svg></div>Noch nicht veröffentlicht"
      I was trying to click it with:
      #include <IE.au3> local $oNNVs = _IEFormGetCollection($oIE2) For $oNNV in $oNNVs If String($oNNV.innertext) = "Noch nicht veröffentlicht" Then _IEAction($oNNV, "click") EndIf Next and:
      $inputs = $oIE2.document.getElementsByTagName("div") For $input In $inputs If $input.innertext == "Noch nicht veröffentlicht" then $input.click() EndIf Next But nothing seems to work. Thanks for the help!
    • By dinotom
      Can files be read from the web or the cloud?
      I am trying to read this file but get the file open error.
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> ;Assign the file path to a variable Local $sFilePath = "C:\Automation\test.txt" Local $sFilePathAzure ="https://batlgroupimages.blob.core.windows.net/files/test.txt" Local $nLineNumberToLookFor = 0 ;Open the file test.txt in append mode. ;If the folder C:\Automation does not exist, it will be created. Local $hFileOpen = FileOpen($sFilePathAzure, $FO_APPEND + $FO_CREATEPATH) ;Display a message box in case of any errors. If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while opening the file.") EndIf ;Set the file position to beginning for reading the data from the beginning of the file. FileSetPos($hFileOpen, 0, $FILE_BEGIN) ;Read the data from the file using the handle returned by FileOpen ;Local $sFileRead = FileRead($hFileOpen) ;Read the 2nd line of data from the file using the handle returned by FileOpen Local $sFileReadLine = FileReadLine ($hFileOpen,2) ;Close the handle returned by FileOpen. FileClose($hFileOpen)  
    • By nacerbaaziz
      hello sirs,
      i have searched allot about an function that can  read the INI file as a  string
      i mean function to read the ini files from string and not from the file directly.
      i finally found an UDF that do what i want
      but unfortunately all the functions work,  but the function that i want it not working.
      this is the udf
      the function that  i need is _IniReadFromString
      this is the function

      Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(", 3) If @error Then Return SetError(1, 0, $Default) ; key not found Return $aRegMl[0] EndFunc;==>_IniReadFromString
      i hope that any one can help me
      thank you in advance
      iniex.au3
    • By Colduction
      Hello AutoIt Scriptwriters! 
      I want to read https based site that it's address is: Soft98 (https://soft98.ir/)
      I've tried with "_INetGetSource", "BinaryToString(InetRead)" and "InetRead" but none of them don't help me
       
      How can i get this site html source code without opening IE Windows? 
       
    • By GillesMaisonneuve
      Good morning,
       
      I am trying to align a two-line text in a button so that it would be centered in the button but can't succeed to do it for the vertical part.
      Can someone tell me what I do wrong ?
      Here is my code:
      $btn3 = GUICtrlCreateButton("Execute " & @LF & " file 1", 100, 65, 60, 50, _ BitOr($BS_CENTER,$BS_BOTTOM,$BS_MULTILINE)) and here is the resulting layout I get in my window.
      I tried to follow the help, made a lot of different parameter combinations (here it's `$BS_BOTTOM`, but I tried `$BS_VCENTER` and `$BS_TOP`), still get the same result : vertical alignement is a no go for me.
      Can someone help ?
      TIA
      Gilles

×
×
  • Create New...