please I have a dub.
I'm developing a strategy in Ticks. When start a bar (ex. 5 min.), in a certain moment an "indicator > Value" and give the signal. I would like to fix this price.
My question: Is there a specify function "One per Bar" or may I use variable?
This is my propose (CalculateOnBarClose = false)
How can you see (in red color) a variable go=1 every first tick of every candle and go=0 when there is the first signal of the indicator. It work fine but maybe there is a better function.
Many thanks!
================================================== =======
protected override void OnBarUpdate()
{
if (FirstTickOfBar)
{
DetectSignalUp = 1;
DetectSignalDown = 1;
}
if (sCandles.SpreadHigh[0]>= LevSpreadCS)
{
if (DetectSignalUp == 1)
{
extremeRed = GetCurrentBid();
Print (Time[0].ToString() + " | " + extremeRed + " | Extreme UP red arrow");
DrawTriangleDown("My triangle down" + CurrentBar, false, 0, extremeRed, Color.Red);
DetectSignalUp = 0;
}
}
else if (sCandles.SpreadLow[0]<= LevSpreadCSLow)
{
if (DetectSignalDown == 1)
{
extremeGreen = GetCurrentAsk();
DrawTriangleUp("My triangle up" + CurrentBar, false, 0, extremeGreen, Color.Lime);
Print (Time[0].ToString() +" | " + extremeGreen + " | Extreme DOWN green arrow");
DetectSignalDown = 0;
}
}
}
Comment