NexusFi: Find Your Edge


Home Menu

 





Action based on the color of an indicator or candlestick


Discussion in NinjaTrader

Updated
    1. trending_up 2,447 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Action based on the color of an indicator or candlestick

  #1 (permalink)
 Diamond5 
omaha Nebraska
 
Experience: Intermediate
Platform: ninjatrader
Broker: Ninja
Trading: stocks, Futures ES, Options
Posts: 22 since Sep 2014
Thanks Given: 7
Thanks Received: 12

First I apologize for not having any code already for this. I've looked and all I can find are examples on how to change the color of a candle or indicator. I would like to create a strategy based on the color of either an indicator or a price bar / candlestick, but for the life of me I cannot find what I need to call to be able to do that.

In short something like:

IF (BarColor[1] == "Green")
{
//buy
}


or

IF (IndicatorPlot[0][1] == "Green")
{
//buy
}



Any help is appreciated and again I apologize if it looks like I haven't done any research.... I have - I just have nothing to show for it.

TIA...

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
TheWizard's Avatar
 TheWizard 
Houston, TX
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Optimus Futures, AMP, CQG
Trading: 6E
Posts: 1,731 since Jun 2009
Thanks Given: 517
Thanks Received: 4,224



Diamond5 View Post
First I apologize for not having any code already for this. I've looked and all I can find are examples on how to change the color of a candle or indicator. I would like to create a strategy based on the color of either an indicator or a price bar / candlestick, but for the life of me I cannot find what I need to call to be able to do that.

In short something like:

IF (BarColor[1] == "Green")
{
//buy
}


or

IF (IndicatorPlot[0][1] == "Green")
{
//buy
}



Any help is appreciated and again I apologize if it looks like I haven't done any research.... I have - I just have nothing to show for it.

TIA...

First, you have to identify what is making the bar color green / red. That's the key.

Example: say you have an indicator that colors the bar green if price closes above the 20 EMA or Red if price closes below the 20 EMA. The code in the indicator would look something like:
if(Close[0]>EMA(20)) BarColor = Color.Green.
if(Close[0]<EMA(20)) BarColor = Color.Red.

It's the code of the indicator that's coloring the bar in this example. So the strategy would have to be coded:

If(Close[0]>EMA(20)) EnterLong(DefaultQuantity, ""); (for long buy)
if(Close[0]<EMA(20)) EnterShort(DefaultQuantity, ""); (for short sell)

Something like that. Can you be specific as to what it is you want to do when such and such a condition occurs?
More information is needed in order to provide a specific answer.

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote
Thanked by:
  #4 (permalink)
 Diamond5 
omaha Nebraska
 
Experience: Intermediate
Platform: ninjatrader
Broker: Ninja
Trading: stocks, Futures ES, Options
Posts: 22 since Sep 2014
Thanks Given: 7
Thanks Received: 12


TheWizard View Post

Something like that. Can you be specific as to what it is you want to do when such and such a condition occurs?
More information is needed in order to provide a specific answer.

It is for an overall strategy, and your response was very helpful! It gives me enough to keep going. Thank you!

Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on September 22, 2014


© 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