we are new into the development with NinjaTrader / NinjaScript. So far we've modified the example strategies that are provided in NinjaTrader 8. Sorry for our basic questions. We try to tade CL futures.
We using Williams R for learning purposes. Our OnBarUpdate methods current looks like this:
protected override void OnBarUpdate() { if (CurrentBar < BarsRequiredToTrade) return; if (this.williams.Value[0] <= 0 && this.williams.Value[0] >= -20) { EnterShort(); } else if (this.williams.Value[0] <= -80 && this.williams.Value[0] >= -100) { EnterLong(); } }
We are aiming to automatically sell within a profit and loss margin (We hope the terminology is correct). For instance, we want to enter a short contract at 50.00$ and automatically sell it at 49.92$ (so 8 ticks down) or 50.12$ (12 ticks up). So far we haven't managed to find out which NinjaScript methods should be used for this.
We've experimented with
SetProfitTarget(CalculationMode.Ticks, 12); SetStopLoss(CalculationMode.Ticks, 8);
How can we realize a sell with these boundaries?
Best regards
Comment