Adding to Open
- This topic has 4 replies, 2 voices, and was last updated 8 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Adding to Open
I am trying to create a simple system that takes the Open price and adds 28 points to it.
This far I can’t seem to get it working right. If I backtest it, the graph shows it always buys on the Open price + 0.5 (half the spread on DAX)
So I think the 28 is left out of the formula.
I have tried multiple things, with all the same result:
c1 = open + 28
c1 = high > (open+28)
c1 = open + 0.028
c1 = (open => 28)
The complete code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Prevents the system from placing new orders on specified days of the week daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 // Conditions to enter long positions c1 = (open + 28) IF c1 AND not daysForbiddenEntry THEN BUY 1 PERPOINT AT MARKET ENDIF // Stops and targets SET STOP pLOSS 70 SET TARGET pPROFIT 9 |
Because the code is only read once per bar at its Close, the program will never met your c1 condition. In order to put a pending order on market (a conditional order) you’ll have to use a STOP or a LIMIT one. In your case, because you want to buy at an higher price than the actual one, you should use STOP order, like this:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated // Prevents the system from placing new orders on specified days of the week daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 IF not daysForbiddenEntry THEN BUY 1 PERPOINT AT close+28*pointsize STOP ENDIF // Stops and targets SET STOP pLOSS 70 SET TARGET pPROFIT 9 |
The stop order will remain active only 1 bar. I use Close instead of Open, because it will put the order at current Close level (+28 points) of the candlestick (when the code is read) and at the next bar open. Hope it’s clear 😀
Thank you Nicolas, that helps a lot!
I can work with this.
If I use this code, will there be a conditional order added to my ‘working orders’ on IG?
Or will it only be visible on ProReal. (ProReal makes a market deal once the parameters are met)
I was hoping I could skip the margin withdrawal 🙂 (other brokers do not take margin for pending orders)
Find exclusive trading pro-tools on