Here is the exact formula, and I stil get the great results. Can someone who also uses tradesim please check this and see if it is true?
EntryTrig:=
Ref(If(Abs(13-BarsSince(Ref(C<bbandBot(C,20,S,2),-1) AND
L>=Ref(L,-1) AND Ref(L,-1)<=Ref(L,-2) AND
Ref(RSI(14)<35,-1)))<=7 AND
Ref(C<bbandBot(C,20,S,1.25),-1) AND Ref(C>BBandBot(C,20,S,2),-1) AND
L>=Ref(L,-1) AND Ref(L,-1)<=Ref(L,-2) AND
Ref(RSI(14),-1)>ValueWhen(1,Ref(C<bbandBot(C,20,S,2),-1) AND
L>=Ref(L,-1) AND Ref(L,-1)<=Ref(L,-2) AND
Ref(RSI(14)<35,-1),Ref(RSI(14),-1)) AND
BarsSince(C>BBandBot(C,20,S,1.25))<barsSince(Ref(C<bbandBot(C,20,S,2),-1) AND
L>=Ref(L,-1) AND Ref(L,-1)<=Ref(L,-2) AND
Ref(RSI(14)<35,-1) ) AND
BarsSince(C<bbandBot(C,20,S,2))>BarsSince(C>BBandBot(C,20,S,1.25)),1,If(Abs(13-BarsSince(Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1)))<=7 AND
Ref(C>BBandTop(C,20,S,1.25),-1) AND Ref(C<bbandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14),-1)<valueWhen(1,Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1),Ref(RSI(14),-1)) AND
BarsSince(C<bbandTop(C,20,S,1.25))<barsSince(Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1)) AND
BarsSince(C>BBandTop(C,20,S,2))>BarsSince(C<bbandTop(C,20,S,1.25)),-1,0)),-1);
EntryPrice:=OPEN;
InitialStop:=C-3*ATR(10);
ExitTrig:=Ref(Abs(13-BarsSince(Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1)))<=7 AND
Ref(C>BBandTop(C,20,S,1.25),-1) AND Ref(C<bbandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14),-1)<valueWhen(1,Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1),Ref(RSI(14),-1)) AND
BarsSince(C<bbandTop(C,20,S,1.25))<barsSince(Ref(C>BBandTop(C,20,S,2),-1) AND
H<=Ref(H,-1) AND Ref(H,-1)>=Ref(H,-2) AND
Ref(RSI(14)>65,-1)) AND
BarsSince(C>BBandTop(C,20,S,2))>BarsSince(C<bbandTop(C,20,S,1.25)),-1);
ExitPrice:=OPEN;
ExtFml("TradeSim.SetStartRecordDate",1,1,1990);
ExtFml( "TradeSim.RecordTrades",
"Bol bands",{ Trade Data Filename }
LONG, { Trade Position Type }
EntryTrig, { Entry Trigger }
EntryPrice, { Entry Price }
InitialStop, { Optional Initial Stop }
ExitTrig, { Exit Trigger }
ExitPrice, { Exit Price }
START); { Recorder Control }