Hi all

I managed to make the backtest work. My logic is that I am using my predictions of close, high and low based on a machine learning model to decide whether I am buying EURUSD, selling or both in a 1 hour timeframe. I want the take profit to be 80% of my predicted high and low respectively. The stop loss I want to be 200% of the difference between open and high and open and low respectively.

I am obviously newbie, so I am not sure if the code does what I want it to do. The returns are negative but my predictions are 0.1% accurate.

I set resolution to be .Hour so I assume onData runs every hour. Is this correct or am I better off with

self.Schedule.On

? If so, how can I say run every hour?

Also there is an OnOrderEvent that I assume runs whenever an order (Market, Limit or Stop) is made. I took this code from another thread in the forum.

Another issue I have is with price. I found in a thread that it is 

price = float(data["EURUSD"].Price)

Ideally I would like the price that my order was filled with because I want to set Take Profit and Stop Loss to be based on that.

There are a lot of self.log because I wanted a way to see what I am doing for debugging.

Any help will be appreciated.

Author