NexusFi: Find Your Edge


Home Menu

 





Dynamic Stop Loss


Discussion in NinjaTrader

Updated
    1. trending_up 5,548 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
wallsteetking
MN
 
Posts: 25 since Feb 2011
Thanks Given: 4
Thanks Received: 0

Hi i am writing a code in nijatrader when I setup the stop loss I can only have a fixed stop loss price for example 10 ticks. However, what I want my stop loss to be is 2 candles prior low. instead of a fixed stop loss.

for example. Ninjatrade enters a Long trade the stop loss should be 2 candles prior low. this way the stop loss can be 5 ticks or 15 ticks. its always changing

Does anyone know how to write that kind of stop loss code in ninjatrader . thank you for your time


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
Kalshi Rockets to $22B, Passes Polymarket in Volume -- B …
Prediction Markets & Event Contracts
Synapse Pro - Trade Copier with topstep and MT5 integrat …
NinjaTrader
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
MegaETH Proves the Crowd Right: Prediction Markets Calle …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090



wallsteetking View Post
Hi i am writing a code in nijatrader when I setup the stop loss I can only have a fixed stop loss price for example 10 ticks. However, what I want my stop loss to be is 2 candles prior low. instead of a fixed stop loss.

for example. Ninjatrade enters a Long trade the stop loss should be 2 candles prior low. this way the stop loss can be 5 ticks or 15 ticks. its always changing

Does anyone know how to write that kind of stop loss code in ninjatrader . thank you for your time

Try this one



if
(Position.MarketPosition == MarketPosition.Long)
{

if enter condition

{

SetStopLoss(CalculationMode.Price, Low[2]);
}
}


Visit my NexusFi Trade Journal Reply With Quote




Last Updated on March 7, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts