NexusFi: Find Your Edge


Home Menu

 





TS - Need color changes when MACD & RSI on crossing zero


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one UHoser with 2 posts (0 thanks)
    2. looks_two bobwest with 1 posts (0 thanks)
    3. looks_3 Marco44 with 1 posts (1 thanks)
    4. looks_4 Shaban with 1 posts (3 thanks)
    1. trending_up 770 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

TS - Need color changes when MACD & RSI on crossing zero

  #1 (permalink)
 
UHoser's Avatar
 UHoser 
Springfield, MA
 
Experience: Intermediate
Platform: Ninja, TradeStation
Trading: Futures and Options
Posts: 3 since Dec 2011
Thanks Given: 3
Thanks Received: 0

Hi

I am looking for a little help, writing code for a TradeStation indicator might be above my pay grade and was wondering if someone, who is more knowledgeable with making a possible minor adjustment or two, to the standard TradeStation MACD and the RSI indicators and would be able to help out.

What I would like to have as an additional input setting, that I would have the ability to change the color of each line, in each indicator, the MACD line and the RSI line, so that whenever it crossed their specific zero line, either from above or from below, that I would have the ability to select a different color for either line on a cross?

If possible, a second input option, would be to change the color the chart background or by plotting a vertical line on the chart, whenever there was a cross that occurred. Also if the chart background would be easier, then I might need the ability to change to the color intensity as well

As an example, when crossing from above and after closing below the zero line, going from say a green to a red color and crossing and closing back above from below, going from a red to a green color line.

I would be very appreciative of any help

UHoser

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Quant vue
Trading Reviews and Vendors
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,172 since Jan 2013
Thanks Given: 57,514
Thanks Received: 26,292


UHoser View Post
Hi

I am looking for a little help, writing code for a TradeStation indicator might be above my pay grade and was wondering if someone, who is more knowledgeable with making a possible minor adjustment or two, to the standard TradeStation MACD and the RSI indicators and would be able to help out.

What I would like to have as an additional input setting, that I would have the ability to change the color of each line, in each indicator, the MACD line and the RSI line, so that whenever it crossed their specific zero line, either from above or from below, that I would have the ability to select a different color for either line on a cross?

If possible, a second input option, would be to change the color the chart background or by plotting a vertical line on the chart, whenever there was a cross that occurred. Also if the chart background would be easier, then I might need the ability to change to the color intensity as well

As an example, when crossing from above and after closing below the zero line, going from say a green to a red color and crossing and closing back above from below, going from a red to a green color line.

I would be very appreciative of any help

UHoser

@UHoser, there are many good TradeStation programmers here who will probably be willing to help you. This appears to be a simple modification to both indicators.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
  #3 (permalink)
Shaban
Turin + Italy
 
Posts: 194 since Feb 2020
Thanks Given: 24
Thanks Received: 129


Hi,

the RSI cannot go below zero, because it is an oscillator that moves between 0 and 100, and so I put in the color green when it goes above 50 and red when it goes below 50;

you try and see if these 2 solutions work for you (see pictures):

MACD with 2 colors: https://postimg.cc/3dxbJq15

RSI with 2 colors: https://postimg.cc/r0gCB8vd


------------------------------------------------------------------------

{MACD with 2 colors}

inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: MyMACD( 0 ), MACDAvg( 0 ), OverSColor( Red ), OverBColor( Green ) ;


MyMACD = MACD( Close, FastLength, SlowLength ) ;
MACDAvg = XAverage( MyMACD, MACDLength ) ;

Plot1( MyMACD, "MACD" ) ;
Plot2( MACDAvg, "MACDAvg", Darkgreen) ;
Plot3( 0, "ZeroLine", Blue ) ;

{ Color criteria }
if MyMACD > 0 then
SetPlotColor( 1, OverBColor )
else if MyMACD < 0 then
SetPlotColor( 1, OverSColor ) ;

-----------------------------------------------------------------------------


{RSI with 2 colors}

inputs:
Price( Close ),
Length( 14 ),
OverSold( 30 ),
OverBought( 70 ),
OverSColor( Red ),
OverBColor(Green) ;

variables: MyRSI( 0 ) ;

MyRSI = RSI( Price, Length ) ;

Plot1( MyRSI, "RSI" ) ;
Plot2( OverBought, "OverBot" ) ;
Plot3( OverSold, "OverSld" ) ;
Plot4( 50, "MidLine", Darkgreen ) ;


{ Color criteria }
if MyRSI > 50 then
SetPlotColor( 1, OverBColor )
else if MyRSI < 50 then
SetPlotColor( 1, OverSColor ) ;


---------------------------------------------------------------------------

Reply With Quote
Thanked by:
  #4 (permalink)
Marco44
Chicago, USA
 
Posts: 5 since Jan 2023
Thanks Given: 6
Thanks Received: 2

Have you tried having chat GPT write the code for you? I have used chat GPT to write several Scripps for tradingView and I t’s surprising how useful it can be. Just make sure your specific in your instructions. It’s also iterative, so you can keep narrowing things down until you get what you’re looking for. Good luck!

Reply With Quote
Thanked by:
  #5 (permalink)
 
UHoser's Avatar
 UHoser 
Springfield, MA
 
Experience: Intermediate
Platform: Ninja, TradeStation
Trading: Futures and Options
Posts: 3 since Dec 2011
Thanks Given: 3
Thanks Received: 0

Shaban and Marco44

I have been distracted shortly after making my post and I am only now, trying to catch up, I appreciate your responses.

Shaban, you are correct about the RSI and the the oscillator moves between 0 and 100, but how I am trying to use it, is with both overbought and oversold levels set to something different than the standard 30/70, so I did not type my message correctly, but again thank you for your help

Started this thread Reply With Quote




Last Updated on April 16, 2023


© 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