Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy the anaPivotZonesDailyV31 levels trading

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy the anaPivotZonesDailyV31 levels trading

    I am trying to write a strategy on trading the level out of the PP of the anaPivotZonesV31 indicator. It was working fine a few days ago, then it is working but missing some trades in the early days of the strategy time frame. Today it is not getting any output, no error in compiling, the Output window only shows today's date. Tried Print "ONE" and Print(anaPivotHigh.PPLow[0])

    ONE
    0
    ONE
    0
    23/06/2011 2:03:20 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='GoLong' Mode=Ticks Value=24 Currency=0 Simulated=False
    23/06/2011 2:03:20 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='GoLong' Mode=Ticks Value=12 Currency=0 Simulated=False
    23/06/2011 2:03:20 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='GoShort' Mode=Ticks Value=24 Currency=0 Simulated=False
    23/06/2011 2:03:20 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='GoShort' Mode=Ticks Value=12 Currency=0 Simulated=False


    My code:

    {
    #region Variables

    private int target = 24;
    private int stop = 12;
    private int entryOffset = 1;
    private int zoneOffset = 2;
    private bool be2 = false;
    private bool be3 = false;
    private bool _initialized = false;


    #endregion

    protected override void Initialize()
    {
    Add(anaPivotZonesDailyV31(anaSessionCountPZD31.Fir st, Color.Yellow, System.Drawing.Drawing2D.DashStyle.Solid, System.Drawing.Drawing2D.DashStyle.Solid, Color.Lime, 10, 200, Color.OrangeRed, Color.MediumSpringGreen, Color.DarkSeaGreen, 5, anaPivotStylesPZD31.Floor, anaSessionTypePZD31.RTH, Color.Magenta, NinjaTrader.Gui.Chart.PlotStyle.Bar, 1, NinjaTrader.Gui.Chart.PlotStyle.Bar, 2, anaPlotAlignPZD31.Left, NinjaTrader.Data.HLCCalculationMode.DailyBars, Color.Orange, false, Color.DeepSkyBlue, 0, 0, 0, Color.MediumOrchid, zoneOffset));

    Add(Vscraper());

    CalculateOnBarClose = true;
    EntryHandling = EntryHandling.UniqueEntries;
    EntriesPerDirection = 1;
    TraceOrders = true;

    SetProfitTarget("GoLong", CalculationMode.Ticks, target);
    SetStopLoss("GoLong", CalculationMode.Ticks, stop, false);
    SetProfitTarget("GoShort", CalculationMode.Ticks, target);
    SetStopLoss("GoShort", CalculationMode.Ticks, stop, false);
    }

    protected override void OnBarUpdate()
    {
    if (!_initialized)
    {
    _initialized = true;
    }
    if (CurrentBar < 1) return;
    if(CurrentBar < 30) return;
    if (Position.MarketPosition != MarketPosition.Flat) return;
    Print("ONE");
    anaPivotZonesDailyV31 anaPivotHigh = anaPivotZonesDailyV31(anaSessionCountPZD31.First, Color.Yellow, System.Drawing.Drawing2D.DashStyle.Solid, System.Drawing.Drawing2D.DashStyle.Solid, Color.Lime, 10, 200, Color.Orange, Color.MediumSpringGreen, Color.DarkSeaGreen, 5, anaPivotStylesPZD31.Floor, anaSessionTypePZD31.RTH, Color.Magenta, NinjaTrader.Gui.Chart.PlotStyle.Bar, 1, NinjaTrader.Gui.Chart.PlotStyle.Bar, 2, anaPlotAlignPZD31.Left, HLCCalculationMode.DailyBars, Color.Orange, false, Color.DeepSkyBlue, 0, 0, 0, Color.MediumOrchid, zoneOffset);
    anaPivotZonesDailyV31 anaPivotLow = anaPivotZonesDailyV31(anaSessionCountPZD31.First, Color.Yellow, System.Drawing.Drawing2D.DashStyle.Solid, System.Drawing.Drawing2D.DashStyle.Solid, Color.Lime, 10, 200, Color.OrangeRed, Color.MediumSpringGreen, Color.DarkSeaGreen, 5, anaPivotStylesPZD31.Floor, anaSessionTypePZD31.RTH, Color.Magenta, NinjaTrader.Gui.Chart.PlotStyle.Bar, 1, NinjaTrader.Gui.Chart.PlotStyle.Bar, 2, anaPlotAlignPZD31.Left, HLCCalculationMode.DailyBars, Color.Orange, false, Color.DeepSkyBlue, 0, 0, 0, Color.MediumOrchid, zoneOffset);

    Print(anaPivotHigh.PPLow[0]);

    // Condition set 1
    if (anaPivotHigh.PPHigh[0] > Low[0] && anaPivotLow.PPLow[0] < Low[0] && Vscraper().Signal[0] == 1)

    {

    EnterLong("GoLong");
    }

    // Condition set 2
    if (anaPivotHigh.PPHigh[0] > High[0]
    && anaPivotLow.PPLow[0] < High[0]
    && Vscraper().Signal[0] == -1)

    EnterShort("GoShort");


    It seems like it is only getting value "0" out of the PPHigh[0]??

    #2
    What broker or datafeed do you use here in your testing? Would it support historical daily data for the pivot calculations in your code?



    You might need to change the HLC Calculation mode to Intraday to adapt.

    Comment


      #3
      I used Zenfire from Mirus. Thanks Bertrand for the hints. I was testing with the ES 09-11. Tried other contract months,seems to work fine, will look further tomorrow, here is 1am.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      650 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X