Code: Select all
if currenttime > starttime and currenttime - value1 > 4 and currenttime < lastordertime then begin
[buy/sell trigger code]
end;
Code: Select all
if currenttime > starttime and currenttime - value1 > 4 and currenttime < lastordertime then begin
[buy/sell trigger code]
end;
The problem with using 'currenttime' and 'lastordertime' is that these are in HHmm or HHmmss format, which means that you can not perform mathematical operations on these (i.e., 1002 [10:02 am] - 5 [minute] = 997 instead of 957 [9:57 am]).I'm trying to create a minimum gap between trades being triggered in a strategy. The following is supposed to stop 2 trades occurring within a 5 minute interval but it doesn't work; i.e trades can be triggered one minute after the previous trade. There is no exit trade, a trade is always open, either long or short.
Code: Select all
if currenttime > starttime and currenttime - value1 > 4 and currenttime < lastordertime then begin
[buy/sell trigger code]
end;