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

    • Epic007
      By Epic007
      Hey guys I'm stuck with a program.....I need a make an automation which copies text from a chat bot app and paste it in notepad to log the replies of my chat bot and to analyse stuff....a lil help pls
       
       
       
       
       
       
       
      Thanks in advance
    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • reida
      By reida
      Hello. Help to write the text.
      <textarea tabindex="4" class="js-input compose__labels__input" style="width: 407px; max-width: 413px;" wrap="off" autocomplete="off" data-original-name="To"></textarea>  I can not make.
      #include <IE.au3> $sLogin = 'adv' $iError = 1 $sUrl = 'https://......' $oIE = _IECreate($sUrl) ;;; _IELoadWait($oIE) $oLogin = _IEGetObjByName($oIE, "To") Sleep(7000) If IsObj($oLogin) Then _IEFormElementSetValue($oLogin, $sLogin) _IELoadWait($oIE) ; EndIf EndIf Through the selector it can be possible?
      #toolkit-154163367424641composeForm > div:nth-child(1) > div > div.compose-head__content.js-collapsed-off > div.compose-head__row-wrapper.compose-head__row-wrapper_to.js-row > div > div > div:nth-child(2) > div > div > div > textarea.js-input.compose__labels__input  
    • Blueman
      By Blueman
      Hey Guys,
      Hope that you can help me with something, maybe this is a bug in the new version of AUTOIT but first i will check it with you to know for sure.
      I have made a simple GUI with a Embedded IE Object, then i would like to read the HTML with _IEBodyReadHTML(), easy right?
      When i use the old IE.au3 include from a year back or so, it is working fine!
      When i use the new IE.au3 include came with the new installation that is currently available on autoitscript.com it isnt working (i get a result that says; 0).
      Let me show you.
       
      Working Example
      #include <GUIConstantsEx.au3> #include <IE_EmbeddedVersioning.au3> #include <IE_PreVersion.au3> ;Older Version Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 1000, 1000) Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Global $oIE_1 = _IECreateEmbedded() ; CREATE IE OBJECT(S) GUICtrlCreateObj($oIE_1, 355, 5, 600, 360) _IENavigate($oIE_1, "https://www.google.nl", 1) Local $CheckHTML_T = _IEBodyReadHTML($oIE_1) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) MsgBox(48,"",$CheckHTML_T) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example  
      Failing Example
      #include <GUIConstantsEx.au3> #include <IE_EmbeddedVersioning.au3> #include <IE.au3> ;New Version Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 1000, 1000) Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) Global $oIE_1 = _IECreateEmbedded() ; CREATE IE OBJECT(S) GUICtrlCreateObj($oIE_1, 355, 5, 600, 360) _IENavigate($oIE_1, "https://www.google.nl", 1) Local $CheckHTML_T = _IEBodyReadHTML($oIE_1) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) MsgBox(48,"",$CheckHTML_T) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example  
      I have attachted all files and i am testing on Windows 10 with the latest SciTe Program (Not compiled). 
      When i compile the script it is showing the same result.
      Thanks guys!
      IE_PreVersion.au3
      IE.au3
      IE_EmbeddedVersioning.au3
×