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
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

    • XinYoung
      By XinYoung
      HI! ... this is a big one (at least for me) 
      You guys previously helped me copy the used range in column A and paste them into a Website one at a time in a loop. Cool! Now, for another function, I have 2 columns, A and B, and two input boxes in the Website. I'm having a hard time replicating the loop for the 2 columns. 
      This is how I'm opening the Excel workbook (copied from the previous function that only had 1 column). I need to also get the used range in column B.
      Func OpenExcelForCopy() Global $aBBTableData Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, $ChosenFileName, Default, True, True) $oExcel.Sheets("CopyCourses").Activate ;~ Get all used cells in column A:A Global $aSearchItems = _Excel_RangeRead($oWorkbook, 1, $oWorkbook.Sheets("CopyCourses").Usedrange.Columns("A:A")) ;~ Duplicate the $aSearchItems Array Global $aSearchResult = $aSearchItems ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = SearchCourseForCopy($aSearchItems[$i]) Next _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") Finished() EndFunc ;==>OpenExcelForCopy Then we eventually get here. I don't think anything needs to change here but I'm not sure. This is where I paste the data from Column A into an input field (which is a search tool in a website). If the search is good, then we get to the tricky part...
      ;~ OK, we logged in and we searched for a course. Lets COPY it! Func CopyCourseBegin() Local $sResult $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then ;~ MsgBox(4096, "Search Error", "Item not found") $sResult = "Source Not Found" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") ;~ Now go back to the Excel sheet and search for the next one. ;~ If the course was found, begin the COPY process. Else For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = CopyCourseNow($aSearchItems[$i]) Next $sResult = "Copied" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") EndIf Return $sResult EndFunc ;==>CopyCourseBegin This is the "tricky part" where I'm confused. I can copy and paste what's in column A just fine, but I can't manage to replicate it for column B. I need to paste whats in Column B into "destinationCourseId"
      ;~ The course search was successful. COPY the course now. Func CopyCourseNow($_sSearchResult) ;~ Navigate to the course copy page. _IENavigate($oIE, $urlBBCourseCopy) ;~ Copy the SOURCE course ID from the Excel sheet ;~ Paste whats copied from column A into the Source Course ID text box Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "sourceCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Paste whats copied from column B into the Destination Course ID text box ?!?!?!?! Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "destinationCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Just exit cause im stuck :( _Exit() EndFunc ;==>CopyCourseNow After I paste the data from column A into "sourceCourseId" and column B into "destinationCourseId", I'll make it do some stuff. Then I need it to loop around until the used ranges in column A & B is finished.
      Does the entire code need to change now that there's two columns?
       
       
    • vin1
      By vin1
      i have a script that selects  a text file and deletes a line (text input required) in the text file selected
      i have to make it remove all lines found on a file i name, toRemoveLines.txt
      it has to remove lines from all text files found in a folder
      this is the script that has to be modified
      where it says "select file" it has to be "select folder"
      where it says "line text input" it has to be all lines from a text file
      #Include <File.au3> Global $success = False $file_name = FileOpenDialog("Select file", @ScriptDir, "All files (*.*)", 1+4) $line_text_input = InputBox("Line's text", "Line must contain following text:", "line contains this text") $file_count_lines = _FileCountLines($file_name) for $i = 0 to $file_count_lines $Lines_text_output = FileReadLine($file_name, $i) if StringInStr($Lines_text_output, $line_text_input) then _FileWriteToLine($file_name, $i, "", 1) $success = True ExitLoop EndIf Next if $success = True Then MsgBox(0, "Success", "Line has been deleted") Else MsgBox(0, "Failure", "Line wasn't found") EndIf  
    • 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
×