Stop loss order placements - futures io
futures io futures trading

Stop loss order placements

Discussion in NinjaTrader

    1. trending_up 739 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Stop loss order placements

(login for full post details)
  #1 (permalink)
Paris France
Posts: 2 since Nov 2015
Thanks: 1 given, 0 received

Hello world!!

I'm a NT7 new user and developing a new strategy. Now, I'm facing a problem with stop loss order placements when I enter a position.
For example, in a long position, I want to set a stop loss order 2 ticks below the lowest low of last 3 bars [since today].

Here is a part of my script :

#region Variables
// User defined variables (add any user defined variables below)
private int stochaMin = 20; // Default setting for StochaMin
private int quantity = 1; // Valeur par Default setting for Quantity

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
CalculateOnBarClose = true;

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()

protected override void Initialize()
CalculateOnBarClose = true;

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
// Resets the stop loss to the original value when all positions are closed
if (Position.MarketPosition == MarketPosition.Flat)
SetStopLoss(CalculationMode.Ticks, 2);

else if(Position.MarketPosition == MarketPosition.Long)
if (Close[0]!=Low[0])
SetStopLoss("Long", CalculationMode.Ticks, MIN(Low,3)[0] - 1*TickSize,true);

//Buying condition
if (Close[0] < Bollinger(2, 14).Lower[0] && Stochastics(5, 14, 3).K[0] < stochaMin)
EnterLong(quantity, "Long");

I was told that I was wrong if I wrote that script. In your opinion, does that code work? Please, can anyone help me?

Thank you in advance!

Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(170 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(116 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
(login for full post details)
  #2 (permalink)
Gits (Hooglede) Belgium
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
rleplae's Avatar
Posts: 2,991 since Sep 2013
Thanks: 2,437 given, 5,801 received

You can find a lot of usefull code that works in the following example :

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote

futures io Trading Community Platforms and Indicators NinjaTrader > Stop loss order placements

Last Updated on December 29, 2015

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1500 prizes from Topstep!


Battlestations! Show us your trading desk - $1,500 in prizes!


Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only

Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts