This will be my first time engaging on this forum, Im new to the pro realtime platform but already benefiting from features (backtesting mainly).
But.. I have ran in to a little bit of a snag, hoping someone can help me out. I’m trying to set a limit on cumulating orders for a strategy, but it’s not respecting my max count. Im sure I’m doing something wrong, I have minimal to no coding experience. Please see screen shot and let me know what you think, any help would be greatly appreciated.
When posting code, please use the text format, either pasting it as is or pasting it using the “insert PRT code” button. To copy it to the clipboard you can either select the text of the code to be copied manually or press the COPY icon highlighted in the attached screenshot X.
The screenshot Y shows where you can find the “insert PRT code” button.
The issue with your system not respecting the maximum position size lies in line 10 of your code…
When the conditions c1 and c2 are true, a position is opened. However, these conditions can remain true for multiple bars (days), which causes the system to keep opening new positions as long as the conditions hold…
The solution is to replace line 10 with the following condition:
If NOT LongOnMarket and c1 and c2 then
This ensures that a new position is only opened when no position is already active…
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.