i have one question regarding the BarsSinceExit function in Multi Time Frame strategies.
My problem is: i only get the exits for the main bar object. i dont get any kind of information about the added bar objects
What i have done:
i have a script with two different short entry rules in two different time frames (0 and 2).
for the exit rule i have a third time frame (1).
the script looks like that
--> Main time frame = 15min
protected override void Initialize()
{
Add(PeriodType.Minute , 3);
Add(PeriodType.Minute , 5);
CalculateOnBarClose = false;
....
}
protected override void OnBarUpdate()
{
// Short 15min
if (BarsInProgress == 0)
{
if (Position.MarketPosition == MarketPosition.Flat
&& ....
{
EnterShort( 0 , 1 ,"S15"); // --> Enter short in bar object 0 ( the 15min time frame)
Print(BarsSinceExit(0,"S15",0));// --> works fine, i get the information about the last exit for this rule
}
}
// Short Entry 5min BB
if (BarsInProgress == 2)
{
if (Position.MarketPosition == MarketPosition.Flat
&& ...
{
EnterShort(2,1,"S5"); // enter short in bar object 2 (the 5 min time frame)
Print(BarsSinceExit(2,"S5",0)) // !!! doesn't work. he says there is no exit in bar object 2 with the signal name "S5" (result =-1)
Print(BarsSinceExit(0,"S5",0)) // also doesn't work. but seems to be okay, because there was no bar oject with entry signal "S5"
Print(BarsSinceExit(2,"",0)) // !!! the result is the exit bar of bar object 0....hm.
}
}
// ######################
// Exit
if (BarsInProgress == 1)
{
if (Position.MarketPosition == MarketPosition.Short
&& ...
{
ExitShort("Target", "");
//ExitShort(2,1,"Target",""); --> the result is the same, i don't get any information about the last exit of my barsinprogress=2 entry-exit pair
}
}
----------------
Finally one "simple" question. What do i have to do, to get the information about the last exit of any existing trade, no matter what time frame or bar object the trade was?
Sorry for the first post, little mistake.
Thx for your answers
Comment