Example if you only want to have the variable “traded” set between 10:00:00 and 19:00:00, each day (of course this won’t work in a Daily, or greater, timeframe):
ok thank you. I have it as you have shown it but I want trade=1 when another condition is fulfilled ie when a trade has happened. The problem I’m facing is traded randomly sets to 1 just before the condition is fulfilled usuallyjsut before DEFPARAM FlatBefore = 080500. |Does DEFPARAM FlatBefore affect variable initialisation?
DEFPARAM FlatBefore does not affect variables, it affects conditions, though, because trades will not be triggered even if all conditions are met (but variables still retain their values as set at each new bar).
To combine other conditions you may add them as follows:
1
2
3
4
5
6
7
8
ONCEStartTime=100000
ONCEEndTime=190000
ONCETraded=0
IF(time<StartTime)OR(time>EndTime)THEN
Traded=0
ELSEIF(conditions)THEN// you may add other conditions here
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue