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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      56 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X