NexusFi: Find Your Edge


Home Menu

 





Moving stop loss and issue backtesting NT7


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one erk707 with 2 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 MXASJ with 1 posts (1 thanks)
    4. looks_4 NinjaTrader with 1 posts (0 thanks)
    1. trending_up 3,559 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 erk707 
Irvine, CA
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Piano, ES, GC, CL, NQ, 6E
Posts: 21 since Feb 2011
Thanks Given: 5
Thanks Received: 4

I have an issue with a strategy I wrote and backtesting in NT7. Its pretty simple but I do not know what I did wrong. Basic example would be I enter a position and have a stop loss of 5 ticks. Once I have gained 5 ticks of profit I want to move the stop loss 5 ticks to the entry point of the trade to protect against loss. When I move to the entry point or any place past the entry point backtesting fails and shows that I am just entering and exiting at the same time. If I specify that when I gain 5 ticks of profit I want to move the stop loss say 4 tick only(something greater than the entry point of the trade) everything works fine. Time doesnt seem to matter, but the moment I try to move the stop to or past the entry price backtesting breaks down and just shows that I win all trades but all its really doing is entering and exiting simotaneously. Is it a common error with NT7, I was thinking of just writing my own code that creates a will say "take profit" stop loss so I can write to the log and view. The problem with the log is if a stop loss is hit no signal is recorded. Any way around this? Or do I have to write my own take profit and then close all other positions.

Any help would be much appreciated.


Started this thread Reply With Quote

 
  #3 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801


What timeframe are you testing on? You will probably want to test on 1 tick time frame and if your trade logic uses a higher timeframe you would add a second dataseries.


Reply With Quote
Thanked by:
  #4 (permalink)
 erk707 
Irvine, CA
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Piano, ES, GC, CL, NQ, 6E
Posts: 21 since Feb 2011
Thanks Given: 5
Thanks Received: 4

Testing on a 3 range bar. Everything works fine until I try to set the stop loss at the same price as entry price. Then backtesting goes crazy and just enters then exits. I have tried other time frame on your note but still same issue. Is there a function in NT7 for setting breakeven?


Started this thread Reply With Quote
  #5 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,715 since May 2010
Thanks Given: 203
Thanks Received: 2,689


erk707 View Post
Testing on a 3 range bar. Everything works fine until I try to set the stop loss at the same price as entry price. Then backtesting goes crazy and just enters then exits. I have tried other time frame on your note but still same issue. Is there a function in NT7 for setting breakeven?

Try changing the stop loss price to the entry price on the bar after you have entered.


Follow me on X Reply With Quote




Last Updated on April 20, 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