NexusFi: Find Your Edge


Home Menu

 





SetPlotColor one bar late


Discussion in EasyLanguage Programming

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




 
Search this Thread

SetPlotColor one bar late

  #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?
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


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 Twitter 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


© 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