NexusFi: Find Your Edge


Home Menu

 





N Bars Before And After Signal


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 
Cachevary's Avatar
 Cachevary 
Russia,Khabarovsk
 
Experience: Beginner
Platform: NT
Trading: Gold
Posts: 407 since Feb 2014

Hey C# Guys,

i have a question about an entry for the strategy that uses 2 algorithms to generate signals.Suppose both algorimths coded to generate a signals on Bar[0].But that`s not always correspond.There are instancies,where the first algo triggers on Bar[1] and the second on Bar[0].So the question is,is there a workaround to add some degree of freedom to the second Algorithm.So if,suppose the X algorithm triggered on Bar[0],how do i get the Y algorithm triggered together with the X,but on any Bars within a certain limit.Example,the X algo triggerd at Bar[0] + the Y algo triggered at any Bars[2]or[1]or[0]or[-1]or[-2] == true

How do i achiev that?

Thanks in advance!


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Eurex Eyes Prediction Markets -- Europes Biggest Derivat …
Prediction Markets & Event Contracts
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
CFTC Workforce Shrinks 24% to 15-Year Low While Predicti …
Traders Hideout
Irans Dual Probability: Guns Quiet at 99.95% While Forma …
Prediction Markets & Event Contracts
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,951 since Dec 2010
Thanks Given: 3,042
Thanks Received: 2,397



Cachevary View Post
Hey C# Guys,

i have a question about an entry for the strategy that uses 2 algorithms to generate signals.Suppose both algorimths coded to generate a signals on Bar[0].But that`s not always correspond.There are instancies,where the first algo triggers on Bar[1] and the second on Bar[0].So the question is,is there a workaround to add some degree of freedom to the second Algorithm.So if,suppose the X algorithm triggered on Bar[0],how do i get the Y algorithm triggered together with the X,but on any Bars within a certain limit.Example,the X algo triggerd at Bar[0] + the Y algo triggered at any Bars[2]or[1]or[0]or[-1]or[-2] == true

How do i achiev that?

Thanks in advance!

Hi @Cachevary,

I will make some guesses as some of the missing information. I assume you are trying to do this within a single strategy. There is no way to "look ahead" so your [-1] is invalid. I would love it in the next NT to have them give use the future, so what I think you are looking for is to trigger with an AND type of relationship.

When you see the conditions true set a global variable like:
m_ConditionX=true
m_ConditionY=true

then:
if (m_ConditionX && m_ConditionY)
{
enter/exit
}

Be sure to reset the X&Y conditions when you don't think they are valid (true).

Another means would be to simply keep checking for Y when you see X is try. This would be useful if Y is complex and difficult to track. Depending upon what "Trigger" is, there are functions that look back such as MAX(barsback)[0] which you can use to check for Y condition. Difficult to answer in this generic form of a question.


Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: [wiki=NT-Local-Order-Manager-LOM-Guide][/wiki]
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
Cachevary's Avatar
 Cachevary 
Russia,Khabarovsk
 
Experience: Beginner
Platform: NT
Trading: Gold
Posts: 407 since Feb 2014

Hello guys,

need assistance in building conditions.

I have:


 
Code
(this.super.Values[0][1] == this.super.Values[3][1] || this.super.Values[1][1] == this.super.Values[3][1] || this.super.Values[2][1] == this.super.Values[3][1])
I need this.super.Values[3][1] to be equal to any other of the 3 sets when on Bar[1].

Suppose there were the following sets that matched:

this.super.Values[0][1] == this.super.Values[3][1]

Now,on bar[0] i need the this.super.Values[3][0] be grater or less then the this.super.Values[0][0] set,i.e this.super.Values[0][0] <or> this.super.Values[3][0].

How do i accomplish that?Please advise!

Thank you.


Started this thread Reply With Quote




Last Updated on January 22, 2015


© 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