Algorithm Executing Wrong prices
Algorithm Executing Wrong prices
16 Jan 2025, 06:34
Hi, the algorithm has a bug.. i Backtested and it was correct. But when i deployed it on cloud,
In Image 1, see Second Row,
@Time = 15 Jan 2025, 22:01,
My algorithm Shorted as u can see. And was suppossed to buy back at a low.
For some RANDOM reason, it bought at 1.36845 which didnt existed. (it is supposed to buy back @ about 1.365) as shown by my drawing.
When i backtested, it made a profit, i dont know why it closed at this price.

Then, my algorithm was supposed to BUY at this low. And sell later on.
For some reason, it BOUGHT at this random price @1.36845.
as shown in the IMAGE 2.
I made a loss from BOTH transaction.
Which in Backtest, iworks as intended (By right its supposed to buy at the bottom as well, but it didnt… But lets ignore this discrepancy for now and focus on the bigger issue. ):

This is hugely disappointing, i left my job to pursue algorithmic trading and i got this……
Replies
claudiorubbiani
09 Feb 2025, 14:23
Well, if it's 22:01 UTC I think it's because of the crazy midnight spread.
Forex USDSGD that you are trading is not regulated and spread is getting creazy at that time.
Ciao, Claudio
@claudiorubbiani
firemyst
25 Jan 2025, 09:48 ( Updated at: 14 Feb 2025, 18:17 )
Maybe you should consider posting your code and/or other information that will help people.
Seriously, how do you expect anyone to be able to help if you don't show your algorithm's code? There could be all sorts of bugs in it.
You might also be testing on 1 minute bars for data whereas your bot reacts to every tick, and thus you actually should be testing on tick-data.
@firemyst