NexusFi: Find Your Edge


Home Menu

 





Managing Trade when Calculate on Close = True


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one jthom with 6 posts (1 thanks)
    2. looks_two dsraider with 6 posts (2 thanks)
    3. looks_3 max-td with 2 posts (0 thanks)
    4. looks_4 aslan with 1 posts (0 thanks)
    1. trending_up 6,624 views
    2. thumb_up 3 thanks given
    3. group 1 followers
    1. forum 15 posts
    2. attach_file 0 attachments




 
Search this Thread

Managing Trade when Calculate on Close = True

  #11 (permalink)
 jthom 
Sydney / Australia
 
Experience: Intermediate
Platform: NT
Broker: AMP
Trading: Oil
Posts: 118 since Jun 2009
Thanks Given: 128
Thanks Received: 105

The indicator is called NCEP2, which is a product of EOT.
I have been testing with Calc at Bar Close on false. I have adjusted the indicator to calc on previous bar. The indicator does not plot correctly and does not trigger orders properly now.
I therefore need to Calculate on Bar Close to be True.

Here is the coding for the entry order method:

{
entryOrder1 = EnterLongLimit(
0, true, DefaultQuantity, Close[0] - 1 * TickSize , "Long 1a");

}

elseif (entryOrder1 != null && entryOrder2 != null && entryOrder1.LimitPrice != null && Close[0] == entryOrder1.LimitPrice + 3 * TickSize)
{
CancelOrder(entryOrder1);
}

Order is placed correctly, but if price moves away more than 3 ticks ( WITHIN THE CURRENT BAR ) it will no cancel order. ie - CALC on Bar CLOSE needs to be true.
Is there any other method of creating 2 seperate strategies and linking them. 1 with COBC = true and 2 with COBC = false.
It is practically impossible to have both in the same strategy, unless im missing something.

Thanks for the help though. Its been greatly appreciated.



Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Exit Strategy
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
60 thanks
Funded Trader platforms
43 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #12 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87


jthom View Post

Order is placed correctly, but if price moves away more than 3 ticks ( WITHIN THE CURRENT BAR ) it will no cancel order. ie - CALC on Bar CLOSE needs to be true.

Hey jthom,

I completely understand your frustration, as I've been there, but I have to stay with my original suggestion. When COBC is set to true, Close[0] = close of the current bar, which is why your cancel order code isn't working properly. When COBC is set to false, Close[0] becomes current price, which is what you need for your cancel code. Since I don't think it's possible to have part of the strat set to true and part set to false, I still suggest using FirstTickOfBar and setting your indicator back a bar.

I went to the site and saw that this isn't a free indicator, so I can understand your not wanting to post. Unfortunately, however, it's hard to know exactly what to do without seeing it. Maybe you can x-out the words and just leave the numbers? So, turn "if (CrossAbove(EMA(20), EMA(50), 0))" to "if (XXX(XXX(20), XXX(50), 0))".

I saw that you tried setting it back one bar and I really do get what you're saying. My original suggestion SHOULD have worked. Maybe someone else will know better, but I don't think I'll be able to come up with anything else without seeing it. Let me know if you'd like me to try that.

Dave

Reply With Quote
Thanked by:
  #13 (permalink)
 jthom 
Sydney / Australia
 
Experience: Intermediate
Platform: NT
Broker: AMP
Trading: Oil
Posts: 118 since Jun 2009
Thanks Given: 128
Thanks Received: 105


dsraider,

Thanks for your advice. Yeah if you set the tradedir[1] for the indicator it will calculate for previous bar, but wont plot an arrow which is required for strategy. Also my PC nearly fried 3 times setting bar close to false. Everything you stated should of worked in theory and I completely understand it. Ill just have to manually exit the order if price moves more than 3 - 4 ticks away.
Greatly appreciated for your help. It is amazing how helpful ppl are hear. Posting something similar on the NT Forums results in "See our Ninjascript Consultants."

Cheers dsraider

Started this thread Reply With Quote
  #14 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Sorry I couldn't be of more help, jthom. Best of luck on the NT forum. I have a strat with several indicators in it with COBC set to false and I really haven't noticed my computer dragging so I hope there's not another issue at play here.

Good luck,
Dave

Reply With Quote
  #15 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


jthom View Post

Posting something similar on the NT Forums results in "See our Ninjascript Consultants."


lol - true !


dsraider, these indicators are closed codes (.dlls) usualy, so it makes no sense to post the stuff.


jthom, the only additional idea i have is : ask Bill at EOT what the problem with the indicator is if used on cobc = false -- maybe he has another idea.

but if the indicator is the main signal-giver - maybe it makes no sense having flashing signals come and go all the time during on bar - especialy with rangebars wich can last longer time.
EOT so far as i know usualy wait for barclose to trigger their entrys.

max-td
Reply With Quote
  #16 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

If you can only look at an indicator real time, then stash it in a dataseries, and check the previous value of the dataseries on first tick of bar.

// on every tick save value
myDataSeries.Set(indValue(parms));

if (FirstTickOfBar) {
// use previous value when new bar is formed
if (myDataSeries[1] .....) {
}
}

Reply With Quote




Last Updated on March 24, 2010


© 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