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.But that`s not always correspond.There are instancies,where the first algo triggers on Bar and the second on Bar.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,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 + the Y algo triggered at any Barsororor[-1]or[-2] == true
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:
if (m_ConditionX && m_ConditionY)
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) which you can use to check for Y condition. Difficult to answer in this generic form of a question.