Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 17:33:32 +0000



[User Discussion] - multiple crossover conditions in ACSIL

View Count: 1320

[2014-02-05 02:30:50]
fhvtrading2 - Posts: 11
Hi,

I am trying out to monitor price crossover of three lines, basically the last crossing condition should prevail until the next crossing. I get two conditions at the same time in some occasions. "crossing middle fm top" and "crossing bottom fm top" seem to be triggered when price crosses the bottomline. What am I missing?


Example code below. Maybe somebody has a pointer.
thanks.


SCFloatArrayRef TopLine = StudyData[1];
SCFloatArrayRef MiddleLine = StudyData[0];
SCFloatArrayRef BottomLine = StudyData[2];

if (sc.CrossOver(Last, TopLine, sc.Index) == CROSS_FROM_BOTTOM)
{
SCString MyString= "crossing top fm bottom";
sc.AddAlertLine(MyString,1);
TopTrade = 0;
MiddleTradeLong = 1;
MiddleTradeShort = 0;
BottomTrade = 0;
}
if (sc.CrossOver(Last, MiddleLine, sc.Index) == CROSS_FROM_TOP)
{
SCString MyString= "crossing middle fm top";
sc.AddAlertLine(MyString,1);
TopTrade = 0;
MiddleTradeLong = 0;
MiddleTradeShort = 0;
BottomTrade = 1;
}
if (sc.CrossOver(Last, MiddleLine, sc.Index) == CROSS_FROM_BOTTOM)
{
SCString MyString= "crossing middle fm bottom";
sc.AddAlertLine(MyString,1);
TopTrade = 1;
MiddleTradeLong = 0;
MiddleTradeShort = 0;
BottomTrade = 0;
}
if (sc.CrossOver(Last, BottomLine, sc.Index) == CROSS_FROM_TOP)
{
SCString MyString= "crossing bottom fm top";
sc.AddAlertLine(MyString,1);
TopTrade = 0;
MiddleTradeLong = 0;
MiddleTradeShort = 1;
BottomTrade = 0;
}

[2014-02-05 18:39:14]
vegasfoster - Posts: 444
Both of the middle line formulas are the same so I think it is getting confused.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account