Merhaba,
VALUEWHEN fonksiyonuna karşılık gelecek kod parçacığı aşağıdaki gibidir.
public override void OnDataUpdate(BarDataCurrentValues barDataCurrentValues)
{
/*
d1 := valuewhen( 2,
cross(most(c, 3, 2),mov(c, 3, e)),
C
)
*/
if (CrossAbove(most, most.ExMOV))
{
CalculateValueWhen(barDataCurrentValues.LastUpdate.BarDataIndex, barDataCurrentValues.LastUpdate.Close);
SendMarketOrder(Symbol, BuyOrderQuantity, OrderSide.Buy);
Debug("Alış Emri Gönderildi");
}
var d1 = GetValueWhen(2);
Debug(d1);
}
int valueWhenIndex = 0;
List<decimal> valueWhenList = new List<decimal>();
private void CalculateValueWhen(int bardataIndex, decimal data)
{
if (valueWhenIndex != bardataIndex)
{
valueWhenList.Add(data);
valueWhenIndex = bardataIndex;
}
}
private decimal GetValueWhen(int period)
{
if (valueWhenList.Count >= period)
{
return valueWhenList[valueWhenList.Count - period];
}
else return 0;
}
Unblocked Games offering a wide range of experiences: action, puzzle, platform, racing, clicker mechanics, strategy, sports, even horror.
https://unblocked1games.github.io