could not find the answer here around, that’s why I made a new topic :
1
2
3
4
5
Ifclose>close[1]then
BUY3sharesATLowest[5](low)limit
endif
The command BUY 3 shares AT Lowest[5](low) limit : gives a limit buy order each time a bar close, defined as the minimum/lowest value of the last 5 closed bars;
as long as the condition close > close[1] is true, the minimum value is recalculated after each bar close.
Two questions:
can the inital limit order be valid for more than one bar ? If yes, what is the PRT-code?
can the initial minimal value be fixed in the code (not being recalculated after a bar) ? If yes, how to code it in PRT ? (with help of barindex – tradeindex or ??)
1 – No, pending Limit/Stop orders expire after one bar and need to be placed again and again as conditions are still met
2 – You need to save that value and not let it be recalculated each new candle (but you will have to, sooner or later, recalculate it, maybe after some bars or at the beginning of a new day)
Using limit orders for more than one bar is also clearly described at the PRT Trading programming Help manual, https://www.prorealtime.com/en/pdf/probacktest.pdf at page 11.
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.