NexusFi: Find Your Edge


Home Menu

 





Dynamic Stop Loss


Discussion in NinjaTrader

Updated
    1. trending_up 5,638 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?
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 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,216
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