The problem I have is when the SMA line is close to the open price of the bar.
In one example the Bid price was 1259.4, the Ask price was 1259.7, the Last Price was 1259.7 and the SMA line at the open was at 1259.5.
When looking a at the bar chart, the bar open was at 1259.7. Does the bar Open price refer to the Last Price or the Ask price?
Also, my code looks at the open price and compares it the SMA line. It seems like the open price is referring to the Bid price because the strategy as I have it now went short at the open of the bar at the 1259.4 price.
It is confusing since the bar open is printed above the SMA line at 1259.7 yet the strategy went short as if the bar opened below the SMA line.
How can I code it so that the strategy refers to the correct open price of the bar as it is printed on the screen when deciding to go long or short? Should I be comparing the Last price at the open instead of the Bid price?
Comment