NexusFi: Find Your Edge


Home Menu

 





SetPlotColor one bar late


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,534 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?
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
29 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
10 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


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