Bot with RSI divergence

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #149843 quote
    Oliviertrader2020
    Participant
    Average

    Hello,

    I’m trying to create an algorithm based on the divergences.
    I tried to call divergence indicators (RSI or MACD) found on the site but it doesn’t work, I think the error comes from my code.

    For example I tried to call the indicator “DivergenceRSIWithLookback”, and to indicate as conditions to buy if the indicator is > to 0 and the close is > to the highest of the previous candle, or to short if the indicator is < to 0 and the close is < to the lowest of the previous candle, But this does not give any trade. I removed the conditions close >high [1] and close

    I removed the variables from the indicator to integrate them directly into the code but it still didn’t work. It still doesn’t work.

    Can someone help me solve this problem? 🙂

    DEFPARAM Cumulateorders = False
    DEFPARAM FLATAFTER = 214400
    DEFPARAM FLATBEFORE = 000100
    
    // Conditions pour ouvrir une position acheteuse
    indicator1 = Call "DivergenceRSIWithLookback"
    c1 = (indicator1 > 0)
    //c2 = close> high[1]
    
    IF c1  AND Not OnMarket THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    
    // Conditions pour ouvrir une position vendeuse
    indicator2 = Call "DivergenceRSIWithLookback"
    c3 = (indicator1 < 0)
    //c4 = close < low[1]
    
    IF c3 AND Not OnMarket THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    
    SET STOP$LOSS 500
    SET TARGET$PROFIT 500
    #149846 quote
    Oliviertrader2020
    Participant
    Average

    PS : Sorry for the readability. I did use the add code function in the initial message, then when I modified it when I noticed the bug but the code continued to be displayed with the text. 🙂

    #149919 quote
    Nicolas
    Keymaster
    Master

    Are you sure the indicator is sending signals? Did you try to GRAPH indicator1, for example?

    #150052 quote
    Oliviertrader2020
    Participant
    Average

    Hello @Nicolas,

    Yes the indicator returns signals as you can see in the screenshot.
    I also tried with the indicator “DivergenceRSIopensource” and the result is the same.

    I also tried with the other indicators you shared on this page: https://www.prorealcode.com/topic/rsi-divergence/#post-23530 but there are still no trades triggered, whatever the asset or time unit.

    Can you help me to program a divergence algorithm? 🙂

    RSI-Divergence-actif.png RSI-Divergence-actif.png NO-TRADE-DIV.png NO-TRADE-DIV.png
    #150217 quote
    Nicolas
    Keymaster
    Master

    You are not GRAPH the indicator in the strategy, I only see the indicators values from ProBuilder on your charts. Please provide the ITF file of your strategy so I can use the same exact indicator as you.

    #150728 quote
    Oliviertrader2020
    Participant
    Average

    Hello Nicolas,

    Here are the 2 indicators and the strategy in itf.

    Thank you for your help.

    DivergenceRSIopensource.itf Divergence-RSI-with-lookback.itf Divergence-Rsi.itf
    #150974 quote
    Oliviertrader2020
    Participant
    Average

    Hello @Nicolas,

    Indicators and strategy in itf can be found in the previous message.
    Thank you for your help.

    #151196 quote
    Nicolas
    Keymaster
    Master

    You have wrongly called an indicator that don’t exist? The signals were not present? In any case, test your variables with GRAPH, it is the first step to debug a code that is malfunctioning.

    PFA the itf file in order to get the complete code working (with indicator embedded).

    Oliviertrader2020 thanked this post
    Divergence-Rsi-2.itf
    #151201 quote
    GraHal
    Participant
    Master

    Below is one error.

    Maybe Nicolas fixed this in the .itf above … I’ll try Nicolas file.

    // Conditions pour ouvrir une position vendeuse
    indicator2 = Call "DivergenceRSIWithLookback"
    c3 = (indicator1 < 0)

    needs to be

    // Conditions pour ouvrir une position vendeuse
    indicator2 = Call "DivergenceRSIWithLookback"
    c3 = (indicator2 < 0) //Indicator2 not indicator 1
    #151202 quote
    GraHal
    Participant
    Master

    Nicolas code works fine … see attached

    Oliviertrader2020 thanked this post
    Ol.jpg Ol.jpg Al-2.jpg Al-2.jpg
    #151240 quote
    Zigo
    Participant
    Master

    Evening,

    I am working on a set up for this topic. What I have already is coupling of the signals on a target-price (TP).

    In the attachment is every line a TP after a signal. Green lines for long trading, yellow lines for short trading.

    DOW-720-SecondenDiv.png DOW-720-SecondenDiv.png
    #151242 quote
    Zigo
    Participant
    Master

    Last signal on 144 sec frame

    DOW-144-SecondenDivergentie.png DOW-144-SecondenDivergentie.png
    #151244 quote
    GraHal
    Participant
    Master

    I know my eyes aren’t great, but I feel like I’ve had 10 pints when looking at the attachment 2 posts above  … it’s all fuzzy with text superimposed on top of other text … is it just me!? 🙂

    #151245 quote
    Vonasi
    Moderator
    Master

    is it just me!? 🙂

    It looks perfectly focused if you view it through the bottom of your second bottle of wine. Don’t ask me how I know.

    GraHal thanked this post
    #151251 quote
    Zigo
    Participant
    Master

    Maybe this looks better, if you have to much C2H5OH in your head.

    Its the same instrument only 100 times lesser candles. To morrow it clearing out.

    GraHal thanked this post
    DOW-12-minutenDivergence.png DOW-12-minutenDivergence.png
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

Bot with RSI divergence


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 18 replies,
has 5 voices, and was last updated by Zigo
5 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/08/2020
Status: Active
Attachments: 14 files
Logo Logo
Loading...