- happylulux: Every time I want to make buy order with the last close price in the function "ontick", I see the price bought in my order several pip higher than what I want, and I don't understand why.You can't buy at the close price (Bid) you buy at the Ask.
-
Your posted code does not contain any open order code.
happylulux:
Because of the spread. Check its value and open a position if it is <= x (such as 2 or lower).
Hi, I'm trying to make an automated trading bot.
Every time I want to make buy order with the last close price in the function "ontick", I see the price bought in my order several pip higher than what I want, and I don't understand why. Somebody can help me?
I'm in a demo account with swissquote as broker.
Here is an example:
here is the code:

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I'm trying to make an automated trading bot.
Every time I want to make buy order with the last close price in the function "ontick", I see the price bought in my order several pip higher than what I want, and I don't understand why. Somebody can help me?
I'm in a demo account with swissquote as broker.
Here is an example:
here is the code: