create a pro backtest using a created indicator

Forums ProRealTime English forum ProOrder support create a pro backtest using a created indicator

Viewing 10 posts - 1 through 10 (of 10 total)
  • #189374

    Hi everyone, I wish to create a probacktest to buy on a bullish signal given on the daily timeframe if it is delivered subsequently to a bullish signal given on the weekly timeframe. I would lie to add to the position if further buy signals are given on the daily so that I compound the entries. A full or partial exit would be if a bearish signal is delivered on the daily timeframe.

    Not interested in entering short on and markets so the probacktest is only for long positions.

    I thank you in anticipation of any help given.

     

    This is the indicator created with the following variables added:

    Variables:

    MyUpperLevel   Integer   70

    MyLowerLevel   Integer   30

    myPeriod   Integer   14

     

    // current RSI
    myRSI = RSI[myPeriod](close)

    // variables we will store between bars
    ONCE myLastHighPrice = 0
    ONCE myLastLowPrice = 1000
    ONCE myLastRSIPeakVal = 1000
    ONCE myLastRSITroughVal = 0

    // set the output default values
    myRSIBullCol = -1
    myRSIBearCol = -1
    myRSIBullDiv = 1
    myRSIBearDiv = -1

    // check for peak
    // *
    // * *
    // 2 1 0
    IF (myRSI < myRSI[1]) AND (myRSI[2] < myRSI[1]) THEN
    IF myRSI[1] >= myUpperLevel THEN

    // great we have a peak above our level lets see if its lower than the prior peak
    IF myRSI[1] < myLastRSIPeakVal THEN

    //ok were lower than the last peak lets check if price was moving up
    IF High > myLastHighPrice THEN

    // we have a bearish divergence change the bar colour
    myRSIBearCol = 1

    ENDIF
    ENDIF

    // we need to remember this peak
    myLastRSIPeakVal = myRSI[1]
    // update the last high price
    myLasthighPrice = High

    ENDIF
    ENDIF

    // check for trough
    // 2 1 0
    // * *
    // *
    IF (myRSI > myRSI[1]) AND (myRSI[2] > myRSI[1]) THEN
    IF myRSI[1] <= myLowerLevel THEN

    // great we have a peak below our level lets see if its higher than the prior peak
    IF myRSI[1] > myLastRSITroughVal THEN

    //ok were lower than the last peak lets check if price was moving up
    IF Low < myLastLowPrice THEN

    // we have a bearish divergence change the bar colour
    myRSIBullCol = 1

    ENDIF
    ENDIF

    // we need to remember this trough
    myLastRSITroughVal = myRSI[1]
    // update the last low
    myLastLowPrice = Low

    ENDIF
    ENDIF

    // finally output the signals
    RETURN myRSIBearDiv COLOURED BY myRSIBearCol AS “Bearish Divergence Signal”, myRSIBullDiv COLOURED BY myRSIBullCol AS “Bullish Divergence Signal”

    #189617

    Your indicator returns nothing.

    Is it working on your charts? If yes, please post the ITF file.

     

    #189659

    Please excuse my ignorance, a itf file is?

    #189660

    It’s the file containing the indicator when exported from ProBuilder (part of the ProRealTime platform that manages indicators).

     

    #189676

    good morning, please find attached one itf file.

    Many thanks for your help.

     

    #189794

    I modified your code, to make it return valid data. You can download and import the attached 123v2 file.

    I attach the trading system file, too.

    That said, well… very few signals are returned on both TFs.

    This is the code (to be run on a Daily chart):

     

     

    #203560

    Hi guys

    Using the following indicator is it possible to add a line of code which would restrict the use of bars to the most recent 15?

     

     

    // current RSI
    myRSI = RSI[myPeriod](close)

    // variables we will store between bars
    ONCE myLastHighPrice = 0
    ONCE myLastLowPrice = 1000
    ONCE myLastRSIPeakVal = 1000
    ONCE myLastRSITroughVal = 0

    // set the output default values
    myRSIBullCol = 0
    myRSIBearCol = 0
    myRSIBullDiv = 0
    myRSIBearDiv = 0

    // check for peak
    // *
    // * *
    // 2 1 0
    IF (myRSI < myRSI[1]) AND (myRSI[2] < myRSI[1]) THEN
    IF myRSI[1] >= myUpperLevel THEN

    // great we have a peak above our level lets see if its lower than the prior peak
    IF myRSI[1] < myLastRSIPeakVal THEN

    //ok were lower than the last peak lets check if price was moving up
    IF High > myLastHighPrice THEN

    // we have a bearish divergence change the bar colour
    myRSIBearCol = 1
    myRSIBearDiv = -1
    myRSIBullDiv = 0
    ENDIF
    ENDIF

    // we need to remember this peak
    myLastRSIPeakVal = myRSI[1]
    // update the last high price
    myLasthighPrice = High

    ENDIF
    ENDIF

    // check for trough
    // 2 1 0
    // * *
    // *
    IF (myRSI > myRSI[1]) AND (myRSI[2] > myRSI[1]) THEN
    IF myRSI[1] <= myLowerLevel THEN

    // great we have a peak below our level lets see if its higher than the prior peak
    IF myRSI[1] > myLastRSITroughVal THEN

    //ok were lower than the last peak lets check if price was moving up
    IF Low < myLastLowPrice THEN

    // we have a bearish divergence change the bar colour
    myRSIBullCol = 1
    myRSIBearDiv = 0
    myRSIBullDiv = 1
    ENDIF
    ENDIF

    // we need to remember this trough
    myLastRSITroughVal = myRSI[1]
    // update the last low
    myLastLowPrice = Low

    ENDIF
    ENDIF

    // finally output the signals
    //RETURN myRSIBearDiv COLOURED BY myRSIBearCol AS “Bearish Divergence Signal”, myRSIBullDiv COLOURED BY myRSIBullCol AS “Bullish Divergence Signal”
    RETURN myRSIBearDiv AS “Bearish Divergence Signal”, myRSIBullDiv AS “Bullish Divergence Signal”

    #203588

    Please attach the ITF file or post the missing variables and their value.

     

    #203597

    Hi Roberto

    Please find attached 1 itf file, in addition the variables are…

    myPeriod = 14

    myUpperLevel = 70

    myLowerLevel = 30

    Many thanks for your help.

    #204253

    Actually myPeriod  restricts the use to the most recent 14 (or any other value you may want to set).

     

Viewing 10 posts - 1 through 10 (of 10 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login