Login Page - Create Account

Support Board


Date/Time: Tue, 22 Apr 2025 16:24:17 +0000



Post From: Annoying problem with Heiken Ashi and ACSIL (for SC engineer)

[2025-01-08 18:37:11]
BenjFlame - Posts: 337
You are right. Thanks.
The problem is elswhere.


// Agressive Scratch Exit
if (ButtonEnableExitAgressiveScratchEnabled)
{



// Unpush state of button after second bar since entry
if (Quantity != 0 && sc.GetBarsSinceLastTradeOrderEntry() > 1)
{
sc.SetCustomStudyControlBarButtonEnable(EnableExitAgressiveScratch, 0);
return;
}

if (sc.GetBarsSinceLastTradeOrderEntry() == 1)
{
// No position
if (Quantity == 0)
{
return;
}


// Exit Short
if (Quantity < 0)
{
if (currentPrice > sc.BaseData[SC_LOW][sc.Index - 2]) /// HERE
{

SCString rrr;
rrr.Format("CurrentPriceLine=%f", currentPrice);
sc.AddMessageToLog(rrr, 0);

SCString ttt;
ttt.Format("BarSinceEntry=%d", sc.GetBarsSinceLastTradeOrderEntry());
sc.AddMessageToLog(ttt, 0);

SCString DebugMessage;
DebugMessage.Format("Low2Bars0=%f", sc.BaseData[SC_LOW][sc.Index]);
sc.AddMessageToLog(DebugMessage, 0);

SCString DebugMessage1;
DebugMessage1.Format("Low2Bars1=%f", sc.BaseData[SC_LOW][sc.Index - 1]);
sc.AddMessageToLog(DebugMessage1, 0);

SCString DebugMessage2;
DebugMessage2.Format("Low2Bars2=%f", sc.BaseData[SC_LOW][sc.Index - 2]);
sc.AddMessageToLog(DebugMessage2, 0);

SCString DebugMessage3;
DebugMessage3.Format("Low2Bars3=%f", sc.BaseData[SC_LOW][sc.Index - 3]);
sc.AddMessageToLog(DebugMessage3, 0);


int Result = sc.FlattenPosition();
sc.CancelAllOrders();

CreateMessageLog(sc, "ShortExit Aggressive Scratch: OK");

if (Result != 1)
{
CreateMessageLog(sc, "Aggressive Scratch Short Exit: Trade didn't pass");
sc.SetCustomStudyControlBarButtonEnable(EnableExitAgressiveScratch, 0);

return;
}
sc.SetCustomStudyControlBarButtonEnable(EnableExitAgressiveScratch, 0);
return;
}
}
}

return;
}


in this code



if (currentPrice > sc.BaseData[SC_LOW][sc.Index - 2]) /// HERE


When I change the index, to let's say -1, then the values logged below for the lows of the few previous bar change. I don't get why. It should all be calculated from sc.GetBarsSinceLastTradeOrderEntry() == 1 so I see no reason why I can't reference correct bar low. Does what I said even makes sense :/ ?
Date Time Of Last Edit: 2025-01-08 18:37:32