Jump to content
dadalt95

Trade Signal - extract information

Recommended Posts

dadalt95

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
dadalt95

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
Danp2

Haven't really reviewed the entire code, but I suspect the error is due to you calling the Captar function from within itself.

Share this post


Link to post
Share on other sites
Danyfirex

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

    • smud
      By smud
      Currently, I'm working on a program that will display Dialog boxes with either Yes or No.
      For each dialog, I reward the user with X amount of Credits.
      I'm hoping to output the amount of credits to a cell in a column (there will be 20 different columns).
      It will only post to a row that is equal to today's date (first column). If no row exists yet with the current date, it will start a new row.
      Any suggestions?
      Thank you
    • reida
      By reida
      Hello. On page there is mail address. How to keep in a text file this address? 
      It is page and email
      https://alpari.com/
      info@alpari.com
    • nacerbaaziz
      By nacerbaaziz
      hi dears
      am using an ini files as a History
      Sometimes the file size is be larger to 5 MB
      AutoIt does not recognize the full content of the file
      When I did a search to find out why, I discovered that INI files could not be read if they size larger than 64 KB.
      for that I preferred to ask here if is there any way to bypass this obstacle.
      The contents of the file are  as follows
      [filesList]
      c:\...\...\f1.mp3=00:15:20
      c:\...\...\f2.mp3=00:10:20
      c:\...\...\f3.wav=00:59:20
      ....... Etc
      This is the section for reading the file (adapted from my main script)

      case $continue     Local $aArray = IniReadSection($WaitingListFile, StringEncrypt(true, "filesList", $MyPassword))     If Not @error Then Opt("GUICloseOnESC", 1) _GUICtrlListView_DeleteAllItems($scList)         For $i = 1 To $aArray[0][0] $path = path_list(StringEncrypt(false, $aArray[$i][0], $MyPassWord), 1) if FileExists(StringEncrypt(false, $aArray[$i][0], $MyPassWord)) then GUICtrlCreateListViewItem(_GetFileName(FileGetLongName(StringEncrypt(false, $aArray[$i][0], $MyPassWord))) & Opt("GUIDataSeparatorChar") & " : " & Opt("GUIDataSeparatorChar") & FileGetLongName(StringEncrypt(false, $aArray[$i][0], $MyPassWord)), $scList) else $path = $path endIf         Next GUISetState(@sw_disable, $hGUI) GUISetState(@sw_show, $hGUI2) GUICtrlSetState($SClist, $GUI_FOCUS) else if $accessibilitymode = 1 then speak(str("listEmpty")) endIf endIf
      Is there any way to solve this problem, please?
      am waiting your answers...
      Greetings to All
    • caramen
      By caramen
      Hey.  
       
      I requested help about how to get a value from a text in a variable. 
      Now i know how to do that. But i learned with the command FileRead. Now i whould like to know how to replace the command :
      FileRead('Dossier.txt') The purpose is to read a webpage text. To find some value inside. 
       
      Btw i tryed to play with WindowsInfo.au3 but i dont got much thing.  
×