What code change would cause this to exit a position intraday at a 30-bar low?
--- In [email protected], "three_percent" <se...@...> wrote: > > Robert, > > I haven't tried to optimize for CAR or RAR. I usually go for CAR/MDD > instead when I run tests. > > Andy > > --- In [email protected], Robert Chevallier <robert.chevallier@> > wrote: > > > > Hi Three_percent > > > > What are your settings to get 100% CAR or RAR on S&P500 ? I'm far from it > > trying your .afl script > > > > 2010/3/30 three_percent <senft@> > > > > > > > > > > > // ATR/Turtle Script by Andrew Senft > > > // > > > > > > Thank you very much for your notes. I took out the ExRem statements out > > > and > > > now get 100% annual returns on the S&P500. A lot more than before. Not > > > sure > > > if that is right. Also, I'm not sure how to get the initial occurance of > > > the > > > buy trigger for the ValueWhen statement. > > > > > > ---------------------------------------------------------- > > > > > > // Backtester Options > > > SetOption("AllowSameBarExit", False); > > > SetOption("MaxOpenPositions",1); > > > PositionSize = -100; > > > > > > // Optimization numbers > > > ATRPeriod = Optimize("ATRPeriod", 15, 10, 100, 5); // 15, .30, 1.08, .15, > > > 25 > > > BuyThreshold = Optimize("BuyThreshold", .3, .1, .50, .05); // 15, .30, > > > 1.06, .25, 25 > > > > > > > > > BuySlope = Optimize("BuySlope", 1.08, 1.05, 1.10, .01); > > > SellThreshold = Optimize("SellThreshold", .15, .1, .50, .05); > > > ProfitPercent = Optimize("ProfitPercent", 25, 25, 35, 5); > > > > > > // Buy/Sell signals and prices > > > MyATR = ATR(ATRPeriod); > > > PrevClose = Ref( Close,-1); > > > Buy = Ref(MyATR,-1) < BuyThreshold AND > > > PrevClose > Ref(Close,-1 * ATRPeriod / 2) AND > > > > > > Ref(Close,-1 * ATRPeriod / 2) > Ref(Close,-1 * ATRPeriod) AND > > > PrevClose / Ref(Close,-1 * ATRPeriod) > BuySlope AND > > > Ref(MA(Volume,20),-1) > 3000 AND // 300,000 volume or more > > > Ref(Close,-1) >= 2; > > > BuyPrice = Open; > > > BeginATR = Ref(ValueWhen(Buy, MyATR,1), -1); > > > Sell = Ref(MyATR,-1) > BeginATR + SellThreshold; > > > SellPrice = Open; > > > PositionScore = 100 - Ref(MyATR,-1); > > > > > > ApplyStop( stopTypeProfit, stopModePercent, ProfitPercent ,True, 0 ); > > > > > >
