Can anyone help with a coding question? I would like the also to exit the position after a certain time, ie on the 5 minutes chart, i would like the position to close 20 minutes after entry.
Remember using the proper forum. ProBuilder is for indicators and ProOrder for strategies. I have already moved your topic to ProOrder. Read the forum rules in case you have any doubt.
Regarding your question, I attached a piece of code that you can use:
1
2
3
4
5
6
7
8
IFconditionANDNOTONMARKETTHEN
BUY1CONTRACTATMARKET// Once your condition is met, the code will buy at market
x=barindex// x = number of the candle in which we have opened the operation
ENDIF
IFbarindex=x+nTHEN// n is the number of candles after the opening. Since you are in a 5 m TF, and want to close after 20 m, then n=4
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.