NexusFi: Find Your Edge


Home Menu

 





Bars Since Pivot


Discussion in NinjaTrader

Updated
    1. trending_up 2,881 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Bars Since Pivot

  #1 (permalink)
 Baseheadz 
Las Vegas, USA
 
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks Given: 1
Thanks Received: 9

I'm attempting to make a filter for identifying a number of bars since a pivot high or low. I have provided the code below. The issue is that currently I have not figured out the logic that properly identifies the pivot high or pivot low and to start counting from that pivot high or pivot low. Any suggestions?

Vars
private int BarsSinceHigh = 0;
private int BarsSinceLow = 0;
private bool BarCount1 = true;
private bool BarCount2 = true;

OBU()

if(MIN(Low,16)[0] < Low[0]) //How do instead create a condition to identify the pivot low?
{
BarsSinceLow=0;
BarCount1=false;

}
else BarsSinceLow++;

if(BarsSinceLow >= 8)
BarCount1 = true;


if(MAX(High,16)[0] > High[0]) How do instead create a condition to identify the pivot High?
{
BarsSinceHigh=0;
BarCount2=false;

}

else BarsSinceHigh++;

if(BarsSinceHigh >= 8)
BarCount2 = true;

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
Increase in trading performance by 75%
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


Identifying pivot highs and lows:

There are basically two methods of identifying highs and lows. One is based on the lookback period, the other one on the minimum deviation.

Lookback period: A pivot of strength 8 would be a candle with a higher high than the 8 preceding and 8 following candles. The pivot high or low would be unconfirmed, if such a candle has just plotted. Confirmation of the pivot high or low will be 8 bars later, if the provisory piovt high or low has not been taken out. I would mark that high or low already when a new candle has a higher high or lower low than the 8 preceding bars. Then keep it, if it is confirmed. To count the candles that have passed from this pivot just collect the CurrentBar, when the pivot is identified. Store the value somewhere. N bars later, you can call CurrentBar again and compare it with the stored value. The difference will be N.

Zigzag : A more elegant way to identify highs and lows is a zigzag indicator which is based on a minimum deviation. You can for example use the zigzag indicator of NinjaTrader and simply access the highs and lows.

Reply With Quote
  #4 (permalink)
 Baseheadz 
Las Vegas, USA
 
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks Given: 1
Thanks Received: 9

Thanks Fat Tails. I'm gonna try the zigzag method. Sounds awesome!

Started this thread Reply With Quote
  #5 (permalink)
 Baseheadz 
Las Vegas, USA
 
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks Given: 1
Thanks Received: 9

Fat Tails,

How would you know when 8 bars has passed on the zigzag indicator after a high has occurred?

This is the overload for the zigzag:
ZigZag(DeviationType.Percent, 0.3, false).ZigZagHigh[8] //I put 8 for 8 bars ago

Started this thread Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


Baseheadz View Post
Fat Tails,

How would you know when 8 bars has passed on the zigzag indicator after a high has occurred?

This is the overload for the zigzag:
ZigZag(DeviationType.Percent, 0.3, false).ZigZagHigh[8] //I put 8 for 8 bars ago

Have just checked that indicator. It is coded in such a weird way that it cannot be easily accessed. Better you code a zigzag indicator yourself.

Reply With Quote




Last Updated on August 13, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts