NexusFi: Find Your Edge


Home Menu

 





Setting a Stop Loss to Activate before Interval Close


Discussion in NinjaTrader

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




 
Search this Thread

Setting a Stop Loss to Activate before Interval Close

  #11 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
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
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,862


stealthtrading View Post
I understand what you're saying and appreciate your explaining the 2 orders (Profit/Stop), but if this is the case I misunderstood the function of the stop. I was under the impression that I could have multiple conditions for exit that could still occur if their criteria was met prior to the Stop(s).

Since this isn't the case, my problem unfortunately remains. I'm running 10 minute intervals, and have a condition that leads to an exit if a loss exceeding -0.04 occurs (if (Position.GetProfitLoss(OnMarketUpdate[0], PerformanceUnit.Percent) < -0.04). This is current a part of OnBarUpdate (which I realize means that it'll only look at the end of each interval).

I need this exit to occur at any time a loss of -4% is reached, instead of only checking at the end of each bar. if I can achievethis by using OnMarketBar or OnMarketUpdate, I'm not sure how to program/code or where to place it. I'm completely ok with it using the 'Last', 'Bid' or 'Ask' to constantly check to see if the Unrealized P/L of -0.04% has been reached.

If you look at the example i have give, that is doing all of this
1. put fixed target/stop at the order (the stop sits on the broker and not your pc
2. update the target/stop based on conditions

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
55 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
29 thanks

  #12 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
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
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,862


stealthtrading View Post
I understand what you're saying and appreciate your explaining the 2 orders (Profit/Stop), but if this is the case I misunderstood the function of the stop. I was under the impression that I could have multiple conditions for exit that could still occur if their criteria was met prior to the Stop(s).

Since this isn't the case, my problem unfortunately remains. I'm running 10 minute intervals, and have a condition that leads to an exit if a loss exceeding -0.04 occurs (if (Position.GetProfitLoss(OnMarketUpdate[0], PerformanceUnit.Percent) < -0.04). This is current a part of OnBarUpdate (which I realize means that it'll only look at the end of each interval).

I need this exit to occur at any time a loss of -4% is reached, instead of only checking at the end of each bar. if I can achievethis by using OnMarketBar or OnMarketUpdate, I'm not sure how to program/code or where to place it. I'm completely ok with it using the 'Last', 'Bid' or 'Ask' to constantly check to see if the Unrealized P/L of -0.04% has been reached.

In OnMarketUpdate, you would do that very much the same as in any other event.
You just use the event for the logic of your code to be execute, you make your test, if the outcome is such that you need to exit, you do so. In my example, you will find the same thing :

(simplified copy of the code : )

 
Code
protected override void OnMarketData (MarketDataEventArgs e)
		{
                    if ("put here your condition")
			    {			
					Print ("You can output something to the output window, it will help you understand the flow");
					ExitLong("Exit","Your Position");
				}
			
		}

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote





Last Updated on April 10, 2016


© 2024 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 - Privacy Policy - Downloads - Top
no new posts