Bull and Bear indicator testing of Another ATR trailing stop

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #108407 quote
    soulintact
    Participant
    Senior

    Good morning,

    I am trying to create a Bull and Bear indicator test, based on Nicola’s recent indicator Another ATR trailing stop.

    My idea was to be able to check several indicators, instead of just ATR. In variable optimization you have to set aaa from 1001 to 1064.

    I receive no errors nor any changeable/meaningful results which is confusing. What am I missing in the code? Thanks!

    //PRC_Testing multiple indicators, 
    //Based on "PRC_Another indicator trailing stop | indicator by //Nicolas @ www.prorealcode.com  | 24.09.2019
    
    //25.09.2019
    
    
    //Indicators 10.3
    if aaa = 1001 then
    aaaa=AccumDistr(close)
    elsif aaa = 1002 then
    aaaa=ADX[14]
    elsif aaa = 1003 then
    aaaa=ADXR[14]
    elsif aaa = 1004 then
    aaaa=AroonDown[14]
    elsif aaa = 1005 then
    aaaa=AroonUp[14]
    elsif aaa = 1006 then
    aaaa=AverageTrueRange[14](close)
    elsif aaa = 1007 then
    aaaa=BollingerBandWidth[20](close)
    elsif aaa = 1008 then
    aaaa=BollingerUp[20](close)
    elsif aaa = 1009 then
    aaaa=BollingerDown[20](close)
    elsif aaa = 1010 then
    aaaa=ChaikinOsc[3,10](close)
    elsif aaa = 1011 then
    aaaa=ChandeKrollStopUp[10, 20, 3]
    elsif aaa = 1012 then
    aaaa=ChandeKrollStopDown[10, 20, 3]
    elsif aaa = 1013 then
    aaaa=Chandle[20](close)
    elsif aaa = 1014 then
    aaaa=CCI[20](typicalPrice)
    elsif aaa = 1015 then
    aaaa=Cycle(close)
    elsif aaa = 1016 then
    aaaa=DEMA[21](close)
    elsif aaa = 1017 then
    aaaa=DI[14](close)
    elsif aaa = 1018 then
    aaaa=DIplus[14](close)
    elsif aaa = 1019 then
    aaaa=DIminus[14](close)
    elsif aaa = 1020 then
    aaaa=EaseOfMovement[14]
    elsif aaa = 1021 then
    aaaa=EMV
    elsif aaa = 1022 then
    aaaa=EndPointAverage[20](close)
    elsif aaa = 1023 then
    aaaa=ExponentialAverage[20](close)
    elsif aaa = 1024 then
    aaaa=ForceIndex(close)
    elsif aaa = 1025 then
    aaaa=HistoricVolatility[20](close)
    elsif aaa = 1026 then
    aaaa=LinearRegression[10](close)
    elsif aaa = 1027 then
    aaaa=LinearRegressionSlope[10](close)
    elsif aaa = 1028 then
    aaaa=MACDline[12,26,9](close)
    elsif aaa = 1029 then
    aaaa=MACD[12,26,9](close)
    elsif aaa = 1030 then
    aaaa=MassIndex[25]
    elsif aaa = 1031 then
    aaaa=Momentum[12](close)
    elsif aaa = 1032 then
    aaaa=MoneyFlow[21](close)
    elsif aaa = 1033 then
    aaaa=Average[20](close)
    elsif aaa = 1034 then
    aaaa=NegativeVolumeIndex(close)
    elsif aaa = 1035 then
    aaaa=OBV(close)
    elsif aaa = 1036 then
    aaaa=SAR[0.02,0.02,0.2]
    elsif aaa = 1037 then
    aaaa=PositiveVolumeIndex(close)
    elsif aaa = 1038 then
    aaaa=PriceOscillator[5,25](close)
    elsif aaa = 1039 then
    aaaa=PVT(close)
    elsif aaa = 1040 then
    aaaa=R2[10](close)
    elsif aaa = 1041 then
    aaaa=ROC[12](close)
    elsif aaa = 1042 then
    aaaa=RSI[14](close)
    elsif aaa = 1043 then
    aaaa=Repulse[5](close)
    elsif aaa = 1044 then
    aaaa=SARatdmf[0.02,0.02,0.2]
    elsif aaa = 1045 then
    aaaa=SmoothedStochastic[14,3](close)
    elsif aaa = 1046 then
    aaaa=STD[20](close)
    elsif aaa = 1047 then
    aaaa=STE[10](close)
    elsif aaa = 1048 then
    aaaa=AroonDown[14]
    elsif aaa = 1049 then
    aaaa=Stochastic[14,3](close)
    elsif aaa = 1050 then
    aaaa=SMI[14,3,5](close)
    elsif aaa = 1051 then
    aaaa=Supertrend[3,10]
    elsif aaa = 1052 then
    aaaa=TEMA[21](close)
    elsif aaa = 1053 then
    aaaa=TimeSeriesAverage[20](close)
    elsif aaa = 1054 then
    aaaa=TriangularAverage[20](close)
    elsif aaa = 1055 then
    aaaa=TRIX[15](close)
    elsif aaa = 1056 then
    aaaa=TR(close)
    elsif aaa = 1057 then
    aaaa=Variation(close)
    elsif aaa = 1058 then
    aaaa=Volatility[10,10]
    elsif aaa = 1059 then
    aaaa=VolumeOscillator[5,25]
    elsif aaa = 1060 then
    aaaa=VolumeROC[12]
    elsif aaa = 1061 then
    aaaa=WeightedAverage[20](close)
    elsif aaa = 1062 then
    aaaa=WilderAverage[20](close)
    elsif aaa = 1063 then
    aaaa=Williams[14](close)
    elsif aaa = 1064 then
    aaaa=WilliamsAccumDistr(close)
    
    
    //--------------------------------------------------------------------------------//
    
    //Modified PRC_Another ATR trailing stop | indicator
    //24.09.2019
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    // --- settings
    //p=14 //ATR period
    mult=2 //multiplier
    mode=1 //trailing stop mode (0=straight line
    // --- end of settings
    
    indicator = aaaa * mult
    
    once trend=1
    
    if trend=1 then
    hh=max(hh,close)
    ll=hh
    if indicator<indicator[1] then
    hhlevel=hh-indicator
    if hhlevel>ts then
    ts=hhlevel
    endif
    endif
    r=0
    //g=168
    else
    ll=min(ll,close)
    hh=ll
    if indicator<indicator[1] then
    lllevel=ll+indicator
    if lllevel<ts then
    ts=lllevel
    endif
    endif
    r=255
    //g=0
    endif
    
    if close crosses over ts then
    trend=1
    if mode>0 then
    ts=ll
    endif
    elsif close crosses under ts then
    trend=-1
    if mode>0 then
    ts=hh
    endif
    endif
    
    
    BullScalp = (r[1]>0 and r=0) or trend=1
    BearScalp = (r>0 and r[1]=0) or trend=-1
    endif
    #108410 quote
    Nicolas
    Keymaster
    Master

    You are building an indicator that doesn’t fit on price.

    The original indicator is a trailing stop line computed with the price +/- ATR values (which is a price value), while you try to make a line with price +/- RSI value?! , that doesn’t make sense, since RSI is a normalized oscillator (a value between 0 to 100%).. and the problem is the same with almost all other indicator you tried.

    So, starting from your idea, you have 2 options:

    1. make a price indicator with indicator that reflect price values (such as STD, STE, ..)
    2. make a similar trailing stop indicator but adapted on oscillator: instead of the price  value, use the oscillator one (but that should make some adaptation of the initial code)..
    soulintact thanked this post
    #108412 quote
    soulintact
    Participant
    Senior

    Thanks Nicola for your prompt reply!

    No wonder… A bit too much Abracadabra from my part.

    As you suggested, making a similar trailing stop indicator but adapted on oscillator: instead of the price  value, seems to be a great idea.

    I have no idea how to do that, but I will dive in to it. If someone gets impatient, please join with some code suggestions, thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Bull and Bear indicator testing of Another ATR trailing stop


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
soulintact @soulintact Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/25/2019
Status: Active
Attachments: No files
Logo Logo
Loading...