Broker simulation

Let say i need to simulate a forex broker at H4 time frame with future order with stop loss and take profit. When i have both ask and bid (close, open, high, low) how i decide if the order is becoming open trade and if the open trade is either closed on take profit or stop loss?


You have no way to determine if the high or the low of the candle came first. The only thing you can do is to be either optimistic (your direction for making money was hit first), pessimistic (your direction for losing money was hit first) or random (pick one of the above for every situation).

Most short-term traders study price charts to help them judge whether price will probably rise or probably fall.

If you think price will probably rise you should buy or set a buy order.

Continue to analyse the price chart when the position is open, and get out if you believe price will probably fall.