Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Action based on the color of an indicator or candlestick
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...
Can you help answer these questions from other members on NexusFi?
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!