NexusFi: Find Your Edge


Home Menu

 





GMMA Oscillator Coding for TOS


Discussion in ThinkOrSwim

Updated
    1. trending_up 8,480 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 3 attachments




 
Search this Thread
  #1 (permalink)
 Zephyr 
Nashville, TN
 
Experience: Intermediate
Platform: TOS + NT
Broker: TBD
Trading: NQ, CL, eminiRussell +
Posts: 49 since Aug 2009
Thanks Given: 26
Thanks Received: 43

Friends ....

I'm writing to ask if someone would be willing to help me finish the coding for the following GMMA Oscillator. I've found the GMMA system, combined with FIBS and the 100 WMA to be a very consistent trading method.

I've (re)coded the following GMMA Oscillator to reflect the price crossing the 100 WMA. When the color changes from RED to BLUE (and vice versa) at the 0 line, it means the price has crossed the 100 WMA - which is a signal to enter a trade. The 100 WMA frequently corresponds to the 50% FIB line when the price crosses it.

My issue is that I only get ONE multi-colored line, which doesn't reflect a cross of the Short Term MA (over or under) the Long Term MA. (See Attachment "TOS GMMA Osc").

The indicator SHOULD look like the one for Ninjatrader ... (See Attachment "NT GMMA Osc").

The following is the CODE I'm currently using in TOS. If you can help me code this properly - so it looks and operates like the one for Ninjatrader, I would be VERY GRATEFUL. I know it's something simple, but I'm missing it somehow ....

Thank you for any help you can provide!

Zephyr
----------------------------

def Short1 = (ExpAverage(Close, 3) + ExpAverage(Close, 5) +
ExpAverage(Close, 8) + ExpAverage(Close, 10) +
ExpAverage(Close, 12) + ExpAverage(Close, 15));

def Long2 = (ExpAverage(Close, 30) + ExpAverage(Close, 35) +
ExpAverage(Close, 40) + ExpAverage(Close, 45) +
ExpAverage(Close, 50) + ExpAverage(Close, 60));

plot GuppyMMAOscillator = ((Short1 - Long2) / Long2) * 100;

GuppyMMAOscillator.AssignValueColor(if Short1 < Long2 then color.red else if Short1 > Long2 then color.BLUE else color.YELLOW);

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GetColor(7));

Attached Thumbnails
Click image for larger version

Name:	TOS GMMA Osc.png
Views:	437
Size:	6.2 KB
ID:	38315   Click image for larger version

Name:	NT GMMA Osc.png
Views:	383
Size:	5.3 KB
ID:	38316  
Attached Files
Elite Membership required to download: NT GMMA Osc Code.txt
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
RSI Values Scale
NinjaTrader
How to: Multi Time-Frame Volume Profile?
NinjaTrader
IBD Accumulation/Distribution Rating
NinjaTrader
NinjaTrader indicator for last bar percentages
NinjaTrader
Time, Futures, Scalping, Treasurys
Treasury Notes and Bonds
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
11 thanks
Just another trading journal: PA, Wyckoff & Trends
8 thanks
Want your NinjaTrader indicator created, free?
3 thanks
Gradient Divergence Trading
2 thanks
Knowledge Nuggets from the Web
2 thanks
  #2 (permalink)
 optntdr13 
Glyndon, Maryland, USA
 
Experience: Advanced
Platform: TOS
Trading: options
Posts: 24 since Sep 2010
Thanks Given: 6
Thanks Received: 49

From what I just read, you need an additional moving average added to the plot of the oscillator itself. You can easily do this via:


plot GuppyMMAOscillator = ((Short1 - Long2) / Long2) * 100;

change this to:
input averageType = {Simple, default Exponential, Weighted, Wilders, Hull};
input length = 13;

def GMMA = ((Short1 - Long2) / Long2) * 100;
def GMMAAvg;
switch (averagetype) {
case simple:
GMMAAvg = Average(GMMA, length);
case Exponential:
GMMAAvg = ExpAverage(GMMA, length);
case Weighted:
GMMAAvg =wma(GMMA, length);
case Wilders:
GMMAAvg = WildersAverage(GMMA, length);
case Hull:
GMMAAvg =hullMovingAvg(GMMA, length);
}

plot GMMAOsc = GMMA;
plot GMMAX = GMMAAvg;

To change the colors like you have above, add the same syntax to the second line of my plot. Perhaps you might consider coloring by whether or not the oscillator is above below it's average...just an idea. If you need help with the syntax, LMK.

Reply With Quote
Thanked by:
  #3 (permalink)
 Zephyr 
Nashville, TN
 
Experience: Intermediate
Platform: TOS + NT
Broker: TBD
Trading: NQ, CL, eminiRussell +
Posts: 49 since Aug 2009
Thanks Given: 26
Thanks Received: 43


Thank you VERY MUCH, optntdr13!


It's very good of you to help with this code. I'll make the changes you've suggested.



Be well ... and thank you again ....

Started this thread Reply With Quote
  #4 (permalink)
sealsup95
Indianapolis
 
Posts: 1 since Nov 2018
Thanks Given: 0
Thanks Received: 0

Can someone help me with this. I can't seem to get this right. I'm trying to piece together the code for ToS previously shown but it's not working out.

Reply With Quote




Last Updated on November 18, 2018


© 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 - Sitemap - Downloads - Top
no new posts