I'm new to coding and NinjaTrader.
I'm trying out a Simple Moving Average Crossover Strategy.
I've been able to set it up so that on the Strategy Analyzer I can find the best Fast and Slow SMA's (when using the Optimization Backtest Type).
I'm now trying to do the same thing but for the Profit Target and Stop Loss Variables, when the Calculation Mode is set for Percentage.
My problem is that when I try and optimise the strategy in the Strategy Analyser; with a range of 0 to 1 and an increment of 0.01 (so I would want to test, e.g. Profit Target 0.02 (i.e. 2%) and Stop Loss of 0.01 (i.e. 1%) and then all other possible percentages), it only runs when the Profit Target and Stop loss are set to 1 (i.e. 100%) and does not run any decimals (referring to them as 0 instead).
I've attached a screenshot of what I mean (https://ibb.co/30szL1J) as well as images of my code (Code 1: https://ibb.co/vq9G9jZ , Code 2: https://ibb.co/BCY4zfq , Code 3: https://ibb.co/W5Pqp4p)
How can I fix this, so that I can find the optimal Profit Target and Stop Loss percentage?
Kind regards,
Stephen
Comment