Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 12:25:36 +0000



Post From: multiple crossover conditions in ACSIL

[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;
}