Buy/Sell at open +/- xx pips/points
Forums › ProRealTime English forum › ProOrder support › Buy/Sell at open +/- xx pips/points
- This topic has 6 replies, 2 voices, and was last updated 2 years ago by robertogozzi.
-
-
03/08/2022 at 2:57 PM #189606
Hi,
I have an idea where I want to buy or sell at the open of the next candle + 2 pips/points in the 1-min timeframe
Now I created the following code:
OrderTollerance = 2
c1 = open>close[1]if not onmarket and c1 and hora1 and hora2 then
Buy possize contract at open+OrderTollerance stop
endifBut when I execute the code act randomly.
Sometime it execute direct at Open of the next candle
Sometimes it sets buy/sell limit above/under the Open of the previous candle
Sometime it set a buy/sell limit of 1 above/under the Open
Is the code correct?
03/08/2022 at 2:58 PM #189607Buy/Sell at Open +/- xx pips/point1234567OrderTollerance = 3c1 = open>close[1]if not onmarket and c1 and hora1 and hora2 thenBuy possize contract at open+OrderTollerance stopendif03/08/2022 at 3:17 PM #189613You are likely to be using a STOP pending order, instead of a LIMIT one.
Can you mke an example of the bar where your conditions are met and the open of which bar you want to enter.
Additionally, do you want to to buy 2 pips above or below the OPEN price?
03/08/2022 at 5:06 PM #189627Hi,
The idea is to buy 2 pips above the OPEN price.
See screenshot attached
03/08/2022 at 5:08 PM #189629Ok, you only have to replace STOP with LIMIT in line 6.
03/08/2022 at 5:32 PM #189632Hi,
I changed the code with LIMIT and it is still the same.
The entry is still at the OPEN price (the using the 2 points) and a few candles later it set the entry 2 points below the OPEN price of the previous candle (see screenshot)
It seems that the ‘OrderTollerance’ is not working
1234567OrderTollerance = 2c1 = open>close[1]if not onmarket and c1 and hora1 and hora2 thenBuy possize contract at open+OrderTollerance LIMITendif03/08/2022 at 7:24 PM #189642Because the current price (CLOSE) is too close to the entry price (on DAX usually IG requires at least 6 points from the entry price, but it may change when volatility is high) and is entered incorrectly (in live trading the strategy would be interrupted).
On the IG website you may find the values for each instrument/asset.
This is the code with the support for the distance:
12345678910111213OrderTollerance = 2Distance = 6c1 = open>close[1]if not onmarket and c1 and hora1 and hora2 thenEntryPrice = open + OrderTolleranceIF close > (EntryPrice + Distance) THENBuy possize contract at EntryPrice LIMITELSIF close < (EntryPrice - Distance) THENBuy possize contract at EntryPrice STOPELSE//Buy possize contract at MARKETENDIFendifI commented out the line where the entry is at MARKET because too close to the Entry price. You may remove the two slashes to enable entering at MARKET in that case.
-
AuthorPosts
Find exclusive trading pro-tools on