Hi Baraz Sergey
Thank you very much!
But I do not quite understand,Ref(),BarsLast(),C # statement to express
,Indicators are invoked with multi-cycle values written in C # how.Thank explain my puzzled.
Kreangast
2013/6/15
Baraz Sergey wrote:
Hi,
I am not familar with amibroker syntax, but in OQ it looks something like this:
Quote:
using System;
using System.Drawing;
using OpenQuant.API;
using OpenQuant.API.Indicators;
public class MyStrategy : Strategy
{
double lastPPFWhenA1IsZero = double.NaN;
public override void OnBar(Bar bar)
{
if (Bars.Count < 20)
return;
double TR= Math.Max(Math.Max((bar.High-bar.Low),Math.Abs(Bars.Ago(1).Close-bar.High)),Math.Abs(Bars.Ago(1).Close-bar.Low));
bool A1 = bar.High == Bars.HighestHigh(20);
double H1=TR*0.5;
if (!A1)
lastPPFWhenA1IsZero = H1;
double PPF=lastPPFWhenA1IsZero;
Console.WriteLine(bar + " PPF = " + PPF);
}
}
Regards,
Sergey.