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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.