A request that was addressed to ProRealTime:
I am looking for the code to stop an automatic intraday system for the rest of the day after 3 consecutive winners or losses on one day.
if intradaybarindex=0 then
countperf=0
sensperf=0
endif
if POSITIONPERF(1) <> POSITIONPERF(1)[1] then
if POSITIONPERF(1) > 0 then
if sensperf=1 then
countperf=countperf+1
else
countperf=1
sensperf=1
endif
elsif POSITIONPERF(1) < 0 then
if sensperf=-1 then
countperf=countperf+1
else
countperf=1
sensperf=-1
endif
endif
endif
countcondition=countperf<3
Note: You have to add countcondition to your buy and sell conditions.