NexusFi: Find Your Edge


Home Menu

 





Projecting a Moving Average


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 10 posts (26 thanks)
    2. looks_two vegasfoster with 6 posts (2 thanks)
    3. looks_3 ThatManFromTexas with 4 posts (1 thanks)
    4. looks_4 WolfieWolf with 3 posts (0 thanks)
      Best Posters
    1. looks_one ehlaban with 4 thanks per post
    2. looks_two Fat Tails with 2.6 thanks per post
    3. looks_3 cusp with 2 thanks per post
    4. looks_4 vegasfoster with 0.3 thanks per post
    1. trending_up 13,932 views
    2. thumb_up 36 thanks given
    3. group 11 followers
    1. forum 30 posts
    2. attach_file 6 attachments




 
Search this Thread

Projecting a Moving Average

  #21 (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,103


ehlaban View Post
You can easily extend a moving average with overriding the Plot() method.
There are some examples and indicators build with it from NT.

Another method


This is certainly a better approach to to plot into the future. Thanks again for mentioning it here.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
use extra computer for optimisation
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #22 (permalink)
 
Sunil P's Avatar
 Sunil P 
los angeles
 
Experience: Intermediate
Platform: nt
Trading: cl
Posts: 290 since Jan 2012

Fats you need to start your own vendor/shop....you will clean house.

Visit my NexusFi Trade Journal Reply With Quote
  #23 (permalink)
 
aligator's Avatar
 aligator 
Las Vegas, NV
Legendary Market Wizard
 
Experience: Advanced
Platform: Abacus, Slide Rule, HP-65
Trading: Futures, Stocks, Options
Posts: 3,621 since Aug 2010
Thanks Given: 1,071
Thanks Received: 5,994


As you know, there is a perfect solution to project future value of any indicator at the close of the bar for fixed size price bars, like range bars.

Visit my NexusFi Trade Journal Reply With Quote
  #24 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844

Thanks Fat Tails, I'm actually doing this in SC, but there is nobody to answer SC programming questions, so I ask for c# and then translate to c++. SC doesn't plot the same as NT, but you have put me on the right track and I am finally making progress on this.

Started this thread Reply With Quote
Thanked by:
  #25 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844


aligator View Post
As you know, there is a perfect solution to project future value of any indicator at the close of the bar for fixed size price bars, like range bars.

You are assuming range bars are always the perfect solution, trust me, there are applications where they are not.

Started this thread Reply With Quote
  #26 (permalink)
 
aligator's Avatar
 aligator 
Las Vegas, NV
Legendary Market Wizard
 
Experience: Advanced
Platform: Abacus, Slide Rule, HP-65
Trading: Futures, Stocks, Options
Posts: 3,621 since Aug 2010
Thanks Given: 1,071
Thanks Received: 5,994


vegasfoster View Post
You are assuming range bars are always the perfect solution, trust me, there are applications where they are not.

Not at all...

Visit my NexusFi Trade Journal Reply With Quote
  #27 (permalink)
 
WolfieWolf's Avatar
 WolfieWolf 
Charlottetown, Prince Edward Island
 
Experience: Advanced
Platform: Ninja
Broker: Optimus - Rithmic
Trading: GC
Posts: 232 since Jul 2010
Thanks Given: 100
Thanks Received: 272

Fat Tails,

This really is black magic and I like it! I've been attempting to build on your sample ana3barPredictor by creating an indicator that calls an instance of MACD for the Line and Average using [-1] for the input:

Line.Set(MACD_DiNapoli(ZLEMA(3), fast,slow,smooth).Value[-1]);
Avg.Set(MACD_DiNapoli(ZLEMA(3), fast,slow,smooth).Avg[-1]);

While this works incredibly well I haven't got a clue how it works; I can't seem to find any documentation on what [-1] represents or what it is actually doing? I also have one small issue. The calling indicator (above) is getting the values of the MACD_DiNapoli as if COBC=false. In order to make this work at all I had to set COBC=false in the MACD_DiNapoli but I want it to be true. If I set it to true in the nested indicator I get no output at all. Is there any way that I can force COBC=true in the nested indicator or at least force the calling indicator to use COBC=true for the nested values?

Hopefully this makes sense?

Thanks for any assistance you can offer

Kind Regards

Wolfie

Reply With Quote
  #28 (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,103


WolfieWolf View Post
Fat Tails,

This really is black magic and I like it! I've been attempting to build on your sample ana3barPredictor by creating an indicator that calls an instance of MACD for the Line and Average using [-1] for the input:

Line.Set(MACD_DiNapoli(ZLEMA(3), fast,slow,smooth).Value[-1]);
Avg.Set(MACD_DiNapoli(ZLEMA(3), fast,slow,smooth).Avg[-1]);

While this works incredibly well I haven't got a clue how it works; I can't seem to find any documentation on what [-1] represents or what it is actually doing? I also have one small issue. The calling indicator (above) is getting the values of the MACD_DiNapoli as if COBC=false. In order to make this work at all I had to set COBC=false in the MACD_DiNapoli but I want it to be true. If I set it to true in the nested indicator I get no output at all. Is there any way that I can force COBC=true in the nested indicator or at least force the calling indicator to use COBC=true for the nested values?

Hopefully this makes sense?

Thanks for any assistance you can offer

Kind Regards

Wolfie

@WolfieWolf: The term Value[-1] does not always exist, so it may well throw an exception. An essential ingredient of my little indicator were the try{} catch{} brackets in order to limit the damage in case that there was no such thing as Value[-1]. Also note that I had asked to displace the indicator that calls the ana3BarPredictor. The displacement compensates for the negative input values for all but the last few bars.

What do you try to achieve?

Joe DiNapoli has used displaced moving averages and other indicators, but his indicators had an additional lag introduced, which would be the opposite of the ability to shift indicator plots forward.

Reply With Quote
Thanked by:
  #29 (permalink)
 
WolfieWolf's Avatar
 WolfieWolf 
Charlottetown, Prince Edward Island
 
Experience: Advanced
Platform: Ninja
Broker: Optimus - Rithmic
Trading: GC
Posts: 232 since Jul 2010
Thanks Given: 100
Thanks Received: 272

Fat Tails,

Thanks for the quick response. To answer your question, "What am I trying to achieve".. I've developed an automated Ninja Strategy based on a simple MACD crossover. It doesn't have to be the DiNapoli MACD, the standard one will do. My signals are quite good but they are, IMHO lagging by one bar; if I could get my signal one bar earlier I would have much better entries and exits. In some cases turning a loser into a B/E and good winners into exceptional ones, etc. So I was attempting to "predict" the MACD values of the next bar so my strategy could execute one bar early. What I have found, however, is that there is a difference between the values of this predictive code real-time vs historic and I can't figure out what's going on. If I do a replay, displaying the indicator on the chart, and then refresh the scripts, the values change. The historic values are exactly what I want, in real time. In a lot of cases the crossovers are much too early, real time. My early assumption was that the [-1] code was using intra-bar data, and not the close of bar data, but now I'm not sure. Any ideas?

Thanks again - you don't realize how much you have helped me just through your participation / involvement in this forum.

Kind Regards

Wolfie

Reply With Quote
  #30 (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,103



WolfieWolf View Post
Fat Tails,

Thanks for the quick response. To answer your question, "What am I trying to achieve".. I've developed an automated Ninja Strategy based on a simple MACD crossover. It doesn't have to be the DiNapoli MACD, the standard one will do. My signals are quite good but they are, IMHO lagging by one bar; if I could get my signal one bar earlier I would have much better entries and exits. In some cases turning a loser into a B/E and good winners into exceptional ones, etc. So I was attempting to "predict" the MACD values of the next bar so my strategy could execute one bar early. What I have found, however, is that there is a difference between the values of this predictive code real-time vs historic and I can't figure out what's going on. If I do a replay, displaying the indicator on the chart, and then refresh the scripts, the values change. The historic values are exactly what I want, in real time. In a lot of cases the crossovers are much too early, real time. My early assumption was that the [-1] code was using intra-bar data, and not the close of bar data, but now I'm not sure. Any ideas?

Thanks again - you don't realize how much you have helped me just through your participation / involvement in this forum.

Kind Regards

Wolfie

You should not be astonished that predictions do not match historical data. Predictions are always false, nothing can be predicted. A prediction is always based on an underlying assumption such as

-> price does not move during the period for which the prediction is made (no feedback)
-> price continues its way in the direction of the prior move (positive feedback)
-> price reverses back to the mean (negative feedback)

Of course nobody knows which of the assumptions is correct, and therefore all predictions hava a high probability of being flawed. That is the reason that I never have used them, except for fun.

If you base your signal on a prediction, your signal will come earlier, but you cannot be sure that the signal will be generated as predicted. In the end you do not gain anything.

Reply With Quote




Last Updated on May 13, 2013


© 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