NexusFi: Find Your Edge


Home Menu

 





Want to create an indicator and have no idea where to start?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one forrestang with 58 posts (9 thanks)
    2. looks_two ThatManFromTexas with 16 posts (5 thanks)
    3. looks_3 LostTrader with 6 posts (2 thanks)
    4. looks_4 cory with 5 posts (3 thanks)
      Best Posters
    1. looks_one cory with 0.6 thanks per post
    2. looks_two ThatManFromTexas with 0.3 thanks per post
    3. looks_3 LostTrader with 0.3 thanks per post
    4. looks_4 forrestang with 0.2 thanks per post
    1. trending_up 26,128 views
    2. thumb_up 20 thanks given
    3. group 5 followers
    1. forum 93 posts
    2. attach_file 30 attachments




 
Search this Thread

Want to create an indicator and have no idea where to start?

  #81 (permalink)
 
lolu's Avatar
 lolu 
Lagos, Nigeria
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader, SierraChart
Trading: Euro Currency & Oil
Frequency: Daily
Duration: Hours
Posts: 2,552 since Jun 2009
Thanks Given: 1,049
Thanks Received: 1,678


forrestang View Post
Yep. That's the plan.

Can backtesting only be done via strat?

Do we have the updated indicator version of your Strat posted ?

Lolu

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
 
  #82 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


lolu View Post
Do we have the updated indicator version of your Strat posted ?

Lolu

If you want to play with it, try this out and let me know if it imports. It's not where I wanted it to be, if I ever finish, I'll post this in the download section or something.

Some notes though:
  • This contains the indie and the strat
  • If you downloaded the original I posted, overwrite them on import since I had to modify the original
  • My strat/indie calls on the original indicators, so if you want to change any of the default values in the original, you have to manually go in and change them in the ORIGINAL indie script itself to get it to reflect in my strat/indie
  • The ERG_Str, I have modified the original values shipped with it, so if you want to change it back, change the "Base Prime" back to 7
  • The ERG_Trade I modified the "SFactor" from the original of 0.5 to 0.25

Attached Files
Elite Membership required to download: Prof_Indicator_Strat.zip
Started this thread Reply With Quote
  #83 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


overwrite option doesnt work but delete all three ERG indis then import strategy works.

Reply With Quote
Thanked by:
  #84 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64

Hello forrestang. I just found your thread -- it looks like this all started while I was out of town. I certainly do not want to derail your programming learning experience. I think that Prof Schamp would have referred you to me if you asked him about how to read the code as I wrote these Ninjatrader indicators for him.

FYI, I just sent him an updated version as I have been working on a wrapper indicator that diagrams his Office entry & exit rule set. However, since it appears that you modified the indicators, that probably does not matter now. I hope you renamed the indicators when you changed the code to avoid confusion with his supported indicators?

good trading!

Reply With Quote
  #85 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


LostTrader View Post
Hello forrestang. I just found your thread -- it looks like this all started while I was out of town. I certainly do not want to derail your programming learning experience. I think that Prof Schamp would have referred you to me if you asked him about how to read the code as I wrote these Ninjatrader indicators for him.

FYI, I just sent him an updated version as I have been working on a wrapper indicator that diagrams his Office entry & exit rule set. However, since it appears that you modified the indicators, that probably does not matter now. I hope you renamed the indicators when you changed the code to avoid confusion with his supported indicators?

good trading!

I definitely wished you had found this thread as it seems you were JUST the person I was looking for LOL. I'll be looking forward to your further comments.

As far as renaming, I DID NOT. I planned to, and that was one of the reasons I wanted to release a bit latter, and figured not many would be using my indicator. But..... the only change I made to the original code really was adding another exposed dataSeries/Variable, which was the "Long Term Strength." Everything else I needed to create MY indicator was already exposed and readily available. I named this variable "lts()"

In your next update, if you could add that simple portion to add that dataSeries in the "exposed variables", it would be helpful, as then everything one would use to replicate the "Office Setups" would be there outwardly accessible to anyone wanting to manipulate things based on the indicators you have created.

Also, my indicator can't be passed any modified user inputs of the original indies, so to make changes in what my indy/strat does (such as changing the base prime), one has to manually go inside the original script of the indies and modify them there to take affect in my study.

Also had you noticed how I set mine up, kind of like a switch board where I can toggle each trade location of the "Office Setups?" So if you only want trades beyond prime, or 0, one can toggle that trade per the office setups.

The format I wrote was like "1c_ABC." Where "1c" references the office setup number. The "ABC" refers to the location of the trade. Strength in quadrant A, Trading ERG in quadrant B, and Trading Histogram in quadrant C. So there are 64 combinations of "1c" trades:
1c_AAA
1c_AAB
1c_AAC
.
.
.
.
1c_DDD

Initially I wanted to test the expectancy of various trade locations, I don't know if one needs that level of detail, but I thought I'd build it in anyway. I took what was probably a very laborious way of scripting this though as you can see.

Started this thread Reply With Quote
  #86 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Quoting 
But..... the only change I made to the original code really was adding another exposed dataSeries/Variable, which was the "Long Term Strength." Everything else I needed to create MY indicator was already exposed and readily available. I named this variable "lts()"

That's interesting - I just went and looked and it is exposed. So that probably happened between the version you used and the latest.
 
Code
[Browsable(false)]    
        [XmlIgnore()]        
        public int LTS
        {
            get { Update(); return dirLTS[0]; }
        }
I have not examined yours yet. I meant to work today and instead have spent all morning reading futures.io (formerly BMT)'s forums! So much for getting work done!

Actually you can pass changes to exposed variables if they are writable. I'll post some examples. The code is different for Indicator vs Strategy. Since you are now writing a Strategy, I'll pull those samples.

Reply With Quote
  #87 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64

This is especially important in Strategies, where you want to ensure that the indicators are using what the Strategy expects. So the Strategy has its own Input variables that are used to set the called Indicators up correctly.

 
Code
#region Variables
private Indicator.ERG_Trade    T_ERG;
private Indicator.ERG_Str1    S_ERG;            
private Indicator.ERG_Trig    E0_ERG;
Initialize()
 
Code
            // -----------------------  Trade
            T_ERG = ERG_Trade(Input);              
            Add( T_ERG );
            // -----------------------  Strength
            S_ERG = ERG_Str1(Input); 
            Add( S_ERG );
            // -----------------------  Timing Trigger
            E0_ERG = ERG_Trig(Input);
OnStartUp()
 
Code
            // -----------------------  Trade            
            T_ERG.BasePrime = basePrime;     T_ERG.M3 = m3;    
            T_ERG.Conf_Reqd = false;
            T_ERG.SCount = sCount; T_ERG.SFactor = sFactor; T_ERG.Enable_T3 = enT3;
            T_ERG.Enable_LTSBarColor = true;
            // -----------------------  Strength
            S_ERG.BasePrime = basePrime; 
            S_ERG.Conf_Reqd = false;
            S_ERG.MinHist = minHIST2;
            // -----------------------  Timing Trigger
            E0_ERG.BasePrime = BasePrime;  
            E0_ERG.Conf_Reqd = false;
// Indicator Input Variables
 
Code
        [Description("Common Denominator of Chart settings (7)")]
        [GridCategory("ERG_Common Parameters")]
        public int BasePrime
        {
            get { return basePrime; }
            set { basePrime = Math.Max(1, value); }
        } 
        [Description("Smoothing Count, typically 3 through 7")]
        [GridCategory("ERG_Trading Parameters")]
        public int SCount
        {
            get { return sCount; }
            set { sCount = Math.Max(1, value); }
        }        
        [Description("Smoothing Factor = damping coefficient for T3 filter")]
        [GridCategory("ERG_Trading Parameters")]
        public double SFactor
        {
            get { return sFactor; }
            set { sFactor = value; }
        }    
        [Description("Smoothing Method = T3 (may be slower)")]
        [GridCategory("ERG_Trading Parameters")]
        [NinjaTrader.Gui.Design.DisplayName("Use T3")]
        public bool Enable_T3
        {
            get { return enT3; }
            set { enT3 = value; }
        }    
        
        [Description("minimum change required for Strength Histogram color change")]
        [GridCategory("ERG_Strength Parameters")]
        public double MinSTRHist
        {
            get { return minHIST2; }
            set { minHIST2 = Math.Max(0, value); }
        }

Reply With Quote
Thanked by:
  #88 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


LostTrader View Post
That's interesting - I just went and looked and it is exposed. So that probably happened between the version you used and the latest.

Hmmm, that was there. I guess I just didn't know how to reference it properly?

Started this thread Reply With Quote
  #89 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


forrestang View Post
Hmmm, that was there. I guess I just didn't know how to reference it properly?

Because it is a dir variable, it is like the others (AKA Slope) in that >0 is up, long, rising, etc and <0 is down, short, falling... 0 is flat or undefined (never set). Unlike the other dir (Slope) it is just the current value, so a single integer, not an IntSeries.

Reply With Quote
  #90 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047



LostTrader View Post
FYI, I just sent him an updated version as I have been working on a wrapper indicator that diagrams his Office entry & exit rule set.

Can you explain what this means as well? What do you mean by "wrapper indicator?"

Started this thread Reply With Quote




Last Updated on January 20, 2012


© 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