Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 2/18/2008 Posts: 20
|
Can you provide me with the real code to add an indicator that plots below my price chart? What I want to plot is a price bar's distance from the 50EMA as a percentage of the 50 EMA. So if the price is above the 50 EMA, I want: (low of the current bar minus the current 50 EMA value)/50EMA * 100. If the price is below the 50 EMA I want: (50 EMA - high of the current bar)/50EMA *100. Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you Drag and Drop the Moving Average from the Chart into the Code tab of the RealCode Editor, it should create something similar to the first line of the RealCode Indicator:
RealCode for Real People: Indicators
'# MA = chart.MovingAverage
If Price.Low > MA.Value Then
Plot = (Price.Low - MA.Value) / MA.Value * 100
Else If Price.High < MA.Value Then
Plot = (MA.Value - Price.High) / MA.Value * 100
Else
Plot = 0
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/18/2008 Posts: 20
|
Perfect! Thank you again.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/18/2008 Posts: 20
|
Can you tell me how to add a paint scheme that will change the price bars from green to red where this indicator is greater than a certain value? For example, I'd like a red price bar when this indicator is greater than 1.0. Thanks again.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Right-click on the RealCode Indicator and select Create Condition | Greater Than: 1.0 and adjust the color of the Condition to Red.
Creating Conditions
Then Drag and Drop the Condition to Price History and select Add to Paint Scheme.
Paint Schemes
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |