this is a first time I m trying to build strategy for GAP UP and GAP Down
I would like to put Dot on chart where
Today Open higher than Yesterday High and (Gap up)
Today Open Lower then Yesterday Low (Gap Down)
I build strategy but Dot are not paint on Daily chart for this example i ran this script on
NQ 03-17
here is code
public class Runner : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(CurrentDayOHL());
Add(PriorDayOHLC());
Add(CurrentDayOHL());
Add(PriorDayOHLC());
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CurrentDayOHL().CurrentOpen[0] > PriorDayOHLC().PriorHigh[0])
{
DrawDot("My dot" + CurrentBar, false, 0, Low[0] + -5 * TickSize, Color.Green);
}
// Condition set 2
if (CurrentDayOHL().CurrentOpen[0] < PriorDayOHLC().PriorLow[0])
{
DrawDot("My dot" + CurrentBar, false, 0, High[0] + 5 * TickSize, Color.Green);
}
}
Can someone tell me what I'm doing wrong here please
Comment