NexusFi: Find Your Edge


Home Menu

 





SetPlotColor one bar late


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011

Hi,

I'm trying to code a simple CCI indicator. When the CCI is going up, colour should be green and red when the CCI is going down. With the code below, the indicator is changing colours one bar too late. Any ideas how to make it react on time?

Thanks.

 
Code
input: fast_length(6),raw_length(20),smooth_length(10),
	zone1(100),zone2(-100),zone3(0),
	upColour(Green), downColour(Red);

variables: slow(0), medium(0), fast(0), raw(0), smooth(0);

fast=cci(fast_length);
raw=cci(raw_length);
smooth=average(raw,smooth_length);

plot1(fast, "6");
plot2(smooth, "Smooth");
plot3(zone1, " ");
plot4(zone2, " ");
plot5(zone3, " ");


if (Plot1 > Plot1[1]) then 
SetPlotColor(1, upColour)
else if (Plot1 < Plot1[1]) then 
SetPlotColor(1, downColour);
Every time the indicator changes direction, the plot color lags one bar. Not all direction changes have been marked in the picture.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Historical Price History?
Elite Algorithmic NinjaTrader Trading
Building models w/Neuroshell and Adaptatrade
Platforms and Indicators
Requesting replay data for...
NinjaTrader
My funded futures (mffu)
Funded Trading Evaluation Firms
GANN THEORY DAVID BOWDEN SAFETY IN THE MARKETS
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tariffs and what comes next...
35 thanks
Looking for advice from seasoned TopSteppers
5 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
Big Mike in Ecuador
3 thanks
Converting NT7 indicators to NT8 for free
3 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


olobay,

this is the way SetPlotColor works. When the condition is detected it will color like that to the next plot value.
You can shift the coloring by one bar adding [1] to SetPlotColor.

Regards,
ABCTG


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011


ABCTG View Post
olobay,

this is the way SetPlotColor works. When the condition is detected it will color like that to the next plot value.
You can shift the coloring by one bar adding [1] to SetPlotColor.

Regards,
ABCTG

Thanks ABCTG. That's exactly what I want.


Started this thread Reply With Quote




Last Updated on December 6, 2014


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