Thanks
================================================== ================================================== ======================
protected override void OnBarUpdate()
{
if (CurrentBar < Length || CurrentBar < 12 || CurrentBar < VolAvg || CurrentBar < VolDelay)
return;
// Persist previous Top and Bot
Top[0] = Top[1];
Bot[0] = Bot[1];
Range_[0] = MAX(High,Length)[0] - MIN(Low,Length)[0];
if (Range_[0] < ConsolidationFactor * Range_[Length])
{
Top[0] = MAX(High, Length)[0];
Bot[0] = MIN(Low, Length)[0];
}
if (ToDay(Time[0]) > 20030101 && Close[0] > Top[0] && Bot[0] > Bot[12]
&& SMA(Volume, VolAvg)[VolDelay] > VolRatio * SMA(Volume, VolAvg)[VolAvg + VolDelay])
{
int ProfitQuantity = 0;
if (TradeProfit)
ProfitQuantity = (int)Math.Floor(SystemPerformance.RealTimeTrades.T radesPerformance.NetProfit / Close[0]);
EnterLong((int)Math.Floor(AmountToBuy/Close[0]) + ProfitQuantity);
}
if (Position.MarketPosition == MarketPosition.Long && Close[0] < Bot[0])
ExitLong();
}
Comment