NexusFi: Find Your Edge


Home Menu

 





SetPlotColor one bar late


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,116 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?
Strike Pause Holds, Oil Erases Monday Spike -- May CPI W …
Traders Hideout
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Hormuz Completely Closed: US Strikes Day 2, Iran Shoots …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


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


© 2026 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