Add
Add
finally use
datetime T;as a global variable
Add
T=Time[0];right below an opening order code
finally use
if (T==Time[2]) { OrderClose(...); }to close the existing order at the opening of the 3rd(current) day.
don't you have to increment T somehow?
What he suggests is:
.. .. OrderSend(...); GlobalVariableSet("TimeOfTradeBar", Time[0]); .. .. if( GlobalVariableGet("TimeOfTradeBar") == Time[2]){ OrderClose(...); }
faqcya:
don't you have to increment T somehow?
Time[n] is the opening time of "n" candle (Current bar is 0), we don't
need to increment it.don't you have to increment T somehow?
phy:
Thanks Phy, What he suggests is:
.. .. OrderSend(...); GlobalVariableSet("TimeOfTradeBar", Time[0]); .. .. if( GlobalVariableGet("TimeOfTradeBar"); == Time[2]){ OrderClose(...) }
from my experience we can put
datetime T;under input parameter(s) to use it as a global variable.
CMIIW
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can Someone please assist me: How can I automatically close an existing Order when two Bars have formed after the Order was sent Originally two days ago. I'm using the Daily Charts. Thank you