Working on automating The Holy Grail & Sharky's method - NinjaTrader Programming | futures io social day trading
futures io futures trading


Working on automating The Holy Grail & Sharky's method
Updated: Views / Replies:4,527 / 15
Created: by BigDog Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Working on automating The Holy Grail & Sharky's method

  #1 (permalink)
Member
Chicago
 
Futures Experience: Advanced
Platform: X_Trader, Ninja
Broker/Data: Advantage/TT and Mirus/ZenFire
Favorite Futures: ES
 
Posts: 60 since Jun 2009
Thanks: 0 given, 16 received

Working on automating The Holy Grail & Sharky's method

If i have an indicator that only paints bars, is it possible to pull that code into a strategy such that I can generate buy/sell signals from it?

I'm trying to automate these two strategies since everyone seems to have good experience (figure why can't this be automated...) adding in some position sizing, unwinding positions faster as risk is built up, etc etc

Trying to start with ADXVMA_sharky indicator... right now it only paints the adx line red/blue/yellow from my understanding...

what I want to implement is when red... sell, when blue... buy, when yellow... do nothing...

(from there on will build on the other indicators)

 
Code
protected override void OnBarUpdate()
{
    if( CurrentBar < 2 )
    {
        PDM.Set( 0 );
        MDM.Set( 0 );
        PDI.Set( 0 );
        MDI.Set( 0 );
        Out.Set( 0 );
        Main.Set( 0 );
        Rising.Set( 0 );
        Falling.Set( 0 );
        Neutral.Set( 0 );
        return;
    }
    try
    {
        int i = 0;
        PDM.Set( 0 );
        MDM.Set( 0 );
        if(Close[i]>Close[i+1])
            PDM.Set( Close[i]-Close[i+1] );//This array is not displayed.
        else
            MDM.Set( Close[i+1]-Close[i] );//This array is not displayed.
        
        PDM.Set(((WeightDM-1)*PDM[i+1] + PDM[i])/WeightDM);//ema.
        MDM.Set(((WeightDM-1)*MDM[i+1] + MDM[i])/WeightDM);//ema.
        
        double TR=PDM[i]+MDM[i];
        
        if (TR>0)
        {
            PDI.Set(PDM[i]/TR);
            MDI.Set(MDM[i]/TR);
        }//Avoid division by zero. Minimum step size is one unnormalized price pip.
        else
        {
            PDI.Set(0);
            MDI.Set(0);
        }
        
        PDI.Set(((WeightDI-1)*PDI[i+1] + PDI[i])/WeightDI);//ema.
        MDI.Set(((WeightDI-1)*MDI[i+1] + MDI[i])/WeightDI);//ema.

        double DI_Diff=PDI[i]-MDI[i];  
        if (DI_Diff<0)
            DI_Diff= -DI_Diff;//Only positive momentum signals are used.
        double DI_Sum=PDI[i]+MDI[i];
        double DI_Factor=0;//Zero case, DI_Diff will also be zero when DI_Sum is zero.
        if (DI_Sum>0)
            Out.Set(DI_Diff/DI_Sum);//Factional, near zero when PDM==MDM (horizonal), near 1 for laddering.
        else
            Out.Set(0);

          Out.Set(((WeightDX-1)*Out[i+1] + Out[i])/WeightDX);
        
        if (Out[i]>Out[i+1])
        {
            HHV=Out[i];
            LLV=Out[i+1];
        }
        else
        {
            HHV=Out[i+1];
            LLV=Out[i];
        }

        for(int j=1;j<Math.Min(ADXPeriod,CurrentBar);j++)
        {
            if(Out[i+j+1]>HHV)HHV=Out[i+j+1];
            if(Out[i+j+1]<LLV)LLV=Out[i+j+1];
        }
        
        
        double diff = HHV - LLV;//Veriable reference scale, adapts to recent activity level, unnormalized.
        double VI=0;//Zero case. This fixes the output at its historical level. 
        if (diff>0)
            VI=(Out[i]-LLV)/diff;//Normalized, 0-1 scale.
        
        //   if (VI_0.VIsq_1.VIsqroot_2==1)VI*=VI;
        //   if (VI_0.VIsq_1.VIsqroot_2==2)VI=MathSqrt(VI);
        //   if (VI>VImax)VI=VImax;//Used by Bemac with VImax=0.4, still used in vma1 and affects 5min trend definition.
                                //All the ema weight settings, including Chande, affect 5 min trend definition.
        //   if (VI<=zeroVIbelow)VI=0;                    
                                
        main.Set(((ChandeEMA-VI)*main[i+1]+VI*Close[i])/ChandeEMA);//Chande VMA formula with ema built in.
        if (main[0] > main[1])
        { Rising.Set(main[0]); Rising.Set(1, main[1]); }
        else if (main[0] < main[1])
        { Falling.Set(main[0]); Falling.Set(1, main[1]); }
        else
        { Neutral.Set(main[0]); Neutral.Set(1, main[1]); }
    }
    catch( Exception ex )
    {
        Print( ex.ToString() );
    }
}
i've bold faced and underlined the area I believe would set the conditions....

any ideas on how this could be done?

Reply With Quote
 
  #2 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

Consider trying some logic like this:

if adxvma rising = true for a certain number of bars // do something long
if adxvma falling = true for a certain number of bars // do something short

Also look at price > adxvma for longs, opposite for shorts
Also look at adxvma main > signal for longs, opposite for shorts

Good luck!

Reply With Quote
 
  #3 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


if (Close[0] >= ADXVMA_sharky_paint(6, true).Main[0]
&& Close[
1] >= ADXVMA_sharky_paint(6, true).Main[1]
&& ADXVMA_sharky_paint(
6, true).Main[0] > ADXVMA_sharky_paint(6, true).Main[1]
&& ADXVMA_sharky_paint(
6, true).Main[1] > ADXVMA_sharky_paint(6, true).Main[2]

// more conditions and go LONG

Is part of the conditions for the LONG side of strat I've been testing recently. It looks for a two bar trend confirmation. Not the fastest, but worth considering.

Reply With Quote
 
  #4 (permalink)
Member
Chicago
 
Futures Experience: Advanced
Platform: X_Trader, Ninja
Broker/Data: Advantage/TT and Mirus/ZenFire
Favorite Futures: ES
 
Posts: 60 since Jun 2009
Thanks: 0 given, 16 received

should have updated earlier... figured it out... i'm a doofus!

was very easy to implement just by simply calling the indicator into the strategy...


going to go through the thread again later tonite to see the specific conditions that = true in order to enter a trade for either strategy...


or if someone once to be a champion and post the exact conditions that'll make life much easier.... have much of the money management logic in place...

running a random entry for the money management nets positive edge, so that much does look good (was tested on 12000+ trades)

Reply With Quote
 
  #5 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 26 since Jul 2009
Thanks: 4 given, 17 received

Hi BigDog,

What money management do you use?

Thanks,

Yuval.

Reply With Quote
 
  #6 (permalink)
Member
Chicago
 
Futures Experience: Advanced
Platform: X_Trader, Ninja
Broker/Data: Advantage/TT and Mirus/ZenFire
Favorite Futures: ES
 
Posts: 60 since Jun 2009
Thanks: 0 given, 16 received


YuvalW View Post
Hi BigDog,

What money management do you use?

Thanks,

Yuval.


scaling, selling or buying more agressively as building up risk, constantly working bids/asks etc

Reply With Quote
 
  #7 (permalink)
Elite Member
Palm Beach Gardens
 
Futures Experience: Intermediate
Platform: Ninja Trader
 
RBSailing's Avatar
 
Posts: 21 since Jun 2009
Thanks: 5 given, 6 received

using indicators in a strategy

I have been using the ADXVMA in a strategy too. I added a a MAslope data series to the indicator, made it a public data series. Then the strat just checks the value ( I used a -1 = negative, 0 = flat , 1 = positive slope) of the data series for the bar you are interested in.

When checking that actual "price" value of the plotted line of an indicator I use the simpler version ie non paint. I think it uses less system resources.

In a strategy that has multiple entry conditions I like to create variables in the strategy that I then set at the beginning of the OnBarUpdate based on the relevant indicator states at that bar. Then instead of calling the indicators over and over I just check the variables.

Reply With Quote
 
  #8 (permalink)
Elite Member
waiblingen Germany
 
Futures Experience: Intermediate
Platform: ninja, Meta 4
Broker/Data: Mirus Zenfire
Favorite Futures: ES, forex
 
Posts: 49 since Jul 2009
Thanks: 7 given, 3 received

Hi RBSailing , you mention a MASlope which I am looking for to work with the TripleEMA with 2 diiferent length, using the longer one as a filter. How can I get an indicator transformed to have the slope? I would like to have a general script to input in different indies. Have you an idea how to do?
Thanks Wolfsch

Reply With Quote
 
  #9 (permalink)
 Vendor: www.innovative-trading-solutions-online.com 
Hartford, CT. USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG, Kinetick
Favorite Futures: TF
 
RJay's Avatar
 
Posts: 677 since Jun 2009
Thanks: 726 given, 740 received


BigDog View Post
If i have an indicator that only paints bars, is it possible to pull that code into a strategy such that I can generate buy/sell signals from it?

I'm trying to automate these two strategies since everyone seems to have good experience (figure why can't this be automated...) adding in some position sizing, unwinding positions faster as risk is built up, etc etc

Trying to start with ADXVMA_sharky indicator... right now it only paints the adx line red/blue/yellow from my understanding...

what I want to implement is when red... sell, when blue... buy, when yellow... do nothing...

(from there on will build on the other indicators)

 
Code
protected override void OnBarUpdate()
{
    if( CurrentBar < 2 )
    {
        PDM.Set( 0 );
        MDM.Set( 0 );
        PDI.Set( 0 );
        MDI.Set( 0 );
        Out.Set( 0 );
        Main.Set( 0 );
        Rising.Set( 0 );
        Falling.Set( 0 );
        Neutral.Set( 0 );
        return;
    }
    try
    {
        int i = 0;
        PDM.Set( 0 );
        MDM.Set( 0 );
        if(Close[i]>Close[i+1])
            PDM.Set( Close[i]-Close[i+1] );//This array is not displayed.
        else
            MDM.Set( Close[i+1]-Close[i] );//This array is not displayed.
        
        PDM.Set(((WeightDM-1)*PDM[i+1] + PDM[i])/WeightDM);//ema.
        MDM.Set(((WeightDM-1)*MDM[i+1] + MDM[i])/WeightDM);//ema.
        
        double TR=PDM[i]+MDM[i];
        
        if (TR>0)
        {
            PDI.Set(PDM[i]/TR);
            MDI.Set(MDM[i]/TR);
        }//Avoid division by zero. Minimum step size is one unnormalized price pip.
        else
        {
            PDI.Set(0);
            MDI.Set(0);
        }
        
        PDI.Set(((WeightDI-1)*PDI[i+1] + PDI[i])/WeightDI);//ema.
        MDI.Set(((WeightDI-1)*MDI[i+1] + MDI[i])/WeightDI);//ema.

        double DI_Diff=PDI[i]-MDI[i];  
        if (DI_Diff<0)
            DI_Diff= -DI_Diff;//Only positive momentum signals are used.
        double DI_Sum=PDI[i]+MDI[i];
        double DI_Factor=0;//Zero case, DI_Diff will also be zero when DI_Sum is zero.
        if (DI_Sum>0)
            Out.Set(DI_Diff/DI_Sum);//Factional, near zero when PDM==MDM (horizonal), near 1 for laddering.
        else
            Out.Set(0);

          Out.Set(((WeightDX-1)*Out[i+1] + Out[i])/WeightDX);
        
        if (Out[i]>Out[i+1])
        {
            HHV=Out[i];
            LLV=Out[i+1];
        }
        else
        {
            HHV=Out[i+1];
            LLV=Out[i];
        }

        for(int j=1;j<Math.Min(ADXPeriod,CurrentBar);j++)
        {
            if(Out[i+j+1]>HHV)HHV=Out[i+j+1];
            if(Out[i+j+1]<LLV)LLV=Out[i+j+1];
        }
        
        
        double diff = HHV - LLV;//Veriable reference scale, adapts to recent activity level, unnormalized.
        double VI=0;//Zero case. This fixes the output at its historical level. 
        if (diff>0)
            VI=(Out[i]-LLV)/diff;//Normalized, 0-1 scale.
        
        //   if (VI_0.VIsq_1.VIsqroot_2==1)VI*=VI;
        //   if (VI_0.VIsq_1.VIsqroot_2==2)VI=MathSqrt(VI);
        //   if (VI>VImax)VI=VImax;//Used by Bemac with VImax=0.4, still used in vma1 and affects 5min trend definition.
                                //All the ema weight settings, including Chande, affect 5 min trend definition.
        //   if (VI<=zeroVIbelow)VI=0;                    
                                
        main.Set(((ChandeEMA-VI)*main[i+1]+VI*Close[i])/ChandeEMA);//Chande VMA formula with ema built in.
        if (main[0] > main[1])
        { Rising.Set(main[0]); Rising.Set(1, main[1]); }
        else if (main[0] < main[1])
        { Falling.Set(main[0]); Falling.Set(1, main[1]); }
        else
        { Neutral.Set(main[0]); Neutral.Set(1, main[1]); }
    }
    catch( Exception ex )
    {
        Print( ex.ToString() );
    }
}
i've bold faced and underlined the area I believe would set the conditions....

any ideas on how this could be done?

Hey BigDog,

I think this strategy is possible. Just one huge problem!!!

This indicator code you are using is repainting the last bar!!!

Check all code lines and do the following.

if the code line updates for both current bar and previous bar like this...

{ Rising.Set(main[0]); Rising.Set(1, main[1]); }

Simply comment out the update to the previous bar like this...

{ Rising.Set(main[0]); // Rising.Set(1, main[1]); }

As far as the strategy goes, when you select this indicator, select indicator output field.

Select each output for each condition. if condition => 1 ( Buy, sell, or do nothing.)

Let me know how it goes,

RJay

Reply With Quote
 
  #10 (permalink)
Elite Member
Palm Beach Gardens
 
Futures Experience: Intermediate
Platform: Ninja Trader
 
RBSailing's Avatar
 
Posts: 21 since Jun 2009
Thanks: 5 given, 6 received



wolfsch View Post
Hi RBSailing , you mention a MASlope which I am looking for to work with the TripleEMA with 2 diiferent length, using the longer one as a filter. How can I get an indicator transformed to have the slope? I would like to have a general script to input in different indies. Have you an idea how to do?
Thanks Wolfsch

There is an indicator in the download section
ColorSampleUniversalMovingAverage
That should do the job for you. I am not sure the exact algorithm they use. I will look at it and posagain. I modified the slope angle calculation that I think originate at NT forum. That calculation averaged the indicator value of the last 2 bars and then compared it to the current value. I removed the averaging so I just check the slope form the last bar to the current bar.
Have you lookad at the LinReg Ma?

Reply With Quote

Reply



futures io > > > > > Working on automating The Holy Grail & Sharky's method

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sim Trading and the Holy Grail tigertrader Traders Hideout 8 January 14th, 2015 08:32 AM
Holy Grail TheWizard Traders Hideout 585 January 3rd, 2015 11:38 AM
Can this be made to an Indicator(HOLY GRAIL) bugsbunny NinjaTrader Programming 2 February 18th, 2011 10:09 AM
Holy Grail Compilation Error HartRend NinjaTrader Programming 3 February 15th, 2011 03:35 PM
Wizard's Holy Grail trades & screenshots TheWizard Trading Journals 27 May 27th, 2010 01:42 AM


All times are GMT -4. The time now is 05:05 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-18 in 0.16 seconds with 19 queries on phoenix via your IP 23.22.136.56