NexusFi: Find Your Edge


Home Menu

 





Simple red-green line (EasyLanguage)


Discussion in EasyLanguage Programming

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




 
Search this Thread

Simple red-green line (EasyLanguage)

(login for full post details)
  #1 (permalink)
swingbatter
Arlington
 
Posts: 18 since Feb 2020
Thanks Given: 6
Thanks Received: 3

Hi Everyone, I bet there's an easy solution. I just want a way to colorize a line appropriately: Green when the line has a positive slope, red when the line has a negative slope.

Here is my code so far, but the color changes 1 period too late:

plot1(close);
if close >= close[1] then setplotcolor(1,green)
else setplotcolor(1,red);

Attached Thumbnails
Click image for larger version

Name:	red-green line.PNG
Views:	97
Size:	6.7 KB
ID:	317347  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
PowerLanguage/EasyLanguage Trying to use a Function as a …
EasyLanguage Programming
Optimal Futures Trading Workflow
Platforms and Indicators
Tradestation historical data to be used in NinjaTrader 8
Platforms and Indicators
Do 5-days or 7-days constitute a Multiweek Channel?
Currencies
Any experience with Affordable Indicators - Duplicate Ac …
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
GFIs1 1 DAX trade per day journal
32 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
18 thanks
Spoo-nalysis ES e-mini futures S&P 500
16 thanks
backup-borg.sh backup-mysql.sh backup-rsync.sh-notused b …
12 thanks
King Of The Nasdaq
9 thanks

(login for full post details)
  #2 (permalink)
swingbatter
Arlington
 
Posts: 18 since Feb 2020
Thanks Given: 6
Thanks Received: 3

It looks good when I shift the graph to the right 1 period, except of course the time is off.

plot1[-1](c);
if c>=c[1] then setplotcolor(1,green)
else setplotcolor(1,red);

Attached Thumbnails
Click image for larger version

Name:	red-green line2.PNG
Views:	87
Size:	4.4 KB
ID:	317349  
Reply With Quote
(login for full post details)
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,422 since Apr 2013
Thanks Given: 437
Thanks Received: 1,616


swingbatter,

try shifting the plot color one bar to the left using Setplotcolor[1] instead of shifting the plot.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
(login for full post details)
  #4 (permalink)
swingbatter
Arlington
 
Posts: 18 since Feb 2020
Thanks Given: 6
Thanks Received: 3

Haha fantastic! Thank you! I have many uses for this.

Reply With Quote





Last Updated on September 16, 2021


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