Heikin Ashi Smoothed code help (Color) - ThinkOrSwim | futures io social day trading
futures io futures trading


Heikin Ashi Smoothed code help (Color)
Updated: Views / Replies:3,785 / 3
Created: by afoxperson Attachments:1

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
 

Heikin Ashi Smoothed code help (Color)

  #1 (permalink)
Elite Member
New York, New York / United States
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: CL, ES, Currencies
 
Posts: 38 since Feb 2015
Thanks: 13 given, 22 received

Heikin Ashi Smoothed code help (Color)

I recently found a code for smoothed heiken ashi bars, however for some reason all the bars are red (down trend). I'm pretty sure I should be putting some if else statements at the end there. Any ideas?? Thanks!

Source Code:

input period = 6;
input hideCandles = YES;
input candleSmoothing = {default Valcu, Vervoort};

DefineGlobalColor("RisingMA", color.green);
DefineGlobalColor("FallingMA", color.red);

input movingAverageType = {default Simple, Exponential, Weighted, Hull, Variable, TEMA};

def openMA;
def closeMA;
def highMA;
def lowMA;

switch (movingAverageType) {
case Simple:
openMA = compoundValue(1, Average(open, period), open);
closeMA = compoundValue(1, Average(close, period), close);
highMA = compoundValue(1, Average(high, period), high);
lowMA = compoundValue(1, Average(low, period), low);
case Exponential:
openMA = compoundValue(1, ExpAverage(open, period), open);
closeMA = compoundValue(1, ExpAverage(close, period), close);
highMA = compoundValue(1, ExpAverage(high, period), high);
lowMA = compoundValue(1, ExpAverage(low, period), low);
case Weighted:
openMA = compoundValue(1, WMA(open, period), open);
closeMA = compoundValue(1, WMA(close, period), close);
highMA = compoundValue(1, WMA(high, period), high);
lowMA = compoundValue(1, WMA(low, period), low);
Case Hull:
openMA = compoundValue(1, HullMovingAvg(open, period), open);
closeMA = compoundValue(1, HullMovingAvg(close, period), close);
highMA = compoundValue(1, HullMovingAvg(high, period), high);
lowMA = compoundValue(1, HullMovingAvg(low, period), low);
case variable:
openMA = compoundValue(1, VariableMA(open, period), open);
closeMA = compoundValue(1, VariableMA(close, period), close);
highMA = compoundValue(1, VariableMA(high, period), high);
lowMA = compoundValue(1, VariableMA(low, period), low);
case TEMA:
openMA = compoundValue(1, TEMA(open, period), open);
closeMA = compoundValue(1, TEMA(close, period), close);
highMA = compoundValue(1, TEMA(high, period), high);
lowMA = compoundValue(1, TEMA(low, period), low);
}


hidePricePlot(hideCandles);

def haOpen;
def haClose;

switch(candleSmoothing) {
case Valcu:

haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
haClose = ((OpenMA + HighMA + LowMA + CloseMA)/4.0) ;

case Vervoort:
haOpen = CompoundValue(1, ( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) /4.0)/2.0), open);
haClose = ((((OpenMA + HighMA + LowMA + CloseMA)/4.0) + haOpen + Max(HighMA, haOpen) + Min(LowMA, haOpen))/4.0);

}

plot o = haopen;
o.hide();

def haLow = min(lowMA, haOpen);
def haHigh = max(highMA,haOpen);

AddChart(high = haHigh, low = haLow, open = o, close = haclose, type = ChartType.CANDLE, growColor = GlobalColor("RisingMA"), fallColor = GlobalColor("FallingMA"), neutralColor = color.gray);

Reply With Quote
The following user says Thank You to afoxperson for this post:
 
  #2 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
 
rmejia's Avatar
 
Posts: 384 since Oct 2010
Thanks: 3,597 given, 421 received

The last part is an unsupported feature, it's not documented anywhere. With the last update to the platform it stopped working. The growColor is being ignored. It used to work fine before the last update, hopefully they will fix it in the future but since it is a hidden feature who knows.

AddChart(high = haHigh, low = haLow, open = o, close = haclose, type = ChartType.CANDLE, growColor = GlobalColor("RisingMA"), fallColor = GlobalColor("FallingMA"), neutralColor = color.gray);

Reply With Quote
The following user says Thank You to rmejia for this post:
 
  #3 (permalink)
Elite Member
New York, New York / United States
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: CL, ES, Currencies
 
Posts: 38 since Feb 2015
Thanks: 13 given, 22 received



rmejia View Post
The last part is an unsupported feature, it's not documented anywhere. With the last update to the platform it stopped working. The growColor is being ignored. It used to work fine before the last update, hopefully they will fix it in the future but since it is a hidden feature who knows.

AddChart(high = haHigh, low = haLow, open = o, close = haclose, type = ChartType.CANDLE, growColor = GlobalColor("RisingMA"), fallColor = GlobalColor("FallingMA"), neutralColor = color.gray);

Thanks for the comment! I figured this out last night. Do you think there's a way around it? Pseudocode looks something like:
AssignPriceColor(
if haclose > haopen then color.GREEN,
if haopen > close then color.RED,
else then color.GREY);

I'm not quite sure if anything like this is possible but it seems plausible. I just don't know enough about thinkscript, or coding, or pretty much trading in general.

Thanks again!

Reply With Quote
 
  #4 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
 
rmejia's Avatar
 
Posts: 384 since Oct 2010
Thanks: 3,597 given, 421 received

Unfortunately I don't know of anything that can be done. I use the addchart on a lower study where the candles used to be red and green but after this broke I just changed it to black. At least the candles are different by fill so there is contrast from that, tho not as clear as using 2 colors.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following user says Thank You to rmejia for this post:

Reply



futures io > > > > Heikin Ashi Smoothed code help (Color)

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
Heiken Ashi Smoothed for Ninja Trader ? sergentpepper7 NinjaTrader Programming 43 August 23rd, 2016 05:41 PM
Heikin-Ashi Chart Code futat MultiCharts 6 April 9th, 2016 11:19 PM
Heikin ashi jguellbo TradeStation 2 April 26th, 2015 05:54 AM
Heikin Ashi indicator with bar outline same color as bar? Todd NinjaTrader 29 September 7th, 2013 08:33 AM
Using Heikin Ashi candels in real time. Srq1 Traders Hideout 17 December 14th, 2012 01:06 AM


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

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-15 in 0.10 seconds with 20 queries on phoenix via your IP 54.82.56.95