MultiCharts - DMI change bar color
futures io futures trading


Categories Help    

MultiCharts
MultiCharts Downloads / MultiCharts Indicators

Share MultiCharts indicators, EasyLanguage indicators.


Entries
DMI change bar color 2 *
I want to change the ID code to change color when there is current bar cross between DM + DM uphill (blue) and down (red). The other bars are still black. View Source (not working)


using System.Drawing;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator
{
public class DMI_joa : IndicatorObject
{
private DirMovement m_dirmovement1;

private IPlotObject Plot1;

private IPlotObject Plot2;

private IPlotObject Plot3;

public DMI_joa(object ctx) :
base(ctx){
adxtrend = 25;
length = 8;
}

[Input]
public int length { get; set; }

[Input]
public double adxtrend { get; set; }

[Input]
public Color UpbarColour { get; set; }

[Input]
public Color DownBarColour { get; set; }

private IPlotObject plotOpen, plotHigh, plotLow, plotClose;

protected override void Create(){
m_dirmovement1 = new DirMovement(this);
Plot1 =
AddPlot(new PlotAttributes("DMI+", 0, Color.Blue,
Color.Empty, 0, 0, true));
Plot2 =
AddPlot(new PlotAttributes("DMI-", 0, Color.Red,
Color.Empty,
0, 0, true));
Plot3 =
AddPlot(new PlotAttributes("ADX", 0, Color.Cyan,
Color.Empty, 0, 0, false));

// Initialize the IPlotObjects
plotHigh = AddPlot(new PlotAttributes("High",
EPlotShapes.BarHigh, Color.Black));
plotLow = AddPlot(new PlotAttributes("Low",
EPlotShapes.BarLow, Color.Black));
plotOpen = AddPlot(new PlotAttributes("Open",
EPlotShapes.LeftTick, Color.Black));
plotClose = AddPlot(new PlotAttributes("Close",
EPlotShapes.RightTick, Color.Black));

// Default values for the inputs
UpbarColour = Color.Green;
DownBarColour = Color.Red;
}

protected override void StartCalc(){
m_dirmovement1.PriceH = Bars.High;
m_dirmovement1.PriceL = Bars.Low;
m_dirmovement1.PriceC = Bars.Close;
m_dirmovement1.Length = length;
}


protected override void CalcBar(){
m_dirmovement1.Call();
Plot1.Set(0, m_dirmovement1.DMIPlus.Value);
Plot2.Set(0, m_dirmovement1.DMIMinus.Value);
Plot3.Set(0, m_dirmovement1.ADX.Value);


if (PublicFunctions.DoubleGreater(m_dirmovement1.ADX.Value, adxtrend))
{
if (this.CrossesOver(m_dirmovement1.DMIPlus, m_dirmovement1.DMIMinus))
{
Alerts.Alert("Bullish alert");
// plotOpen.Set(Bars.Open[0], UpbarColour);
// plotHigh.Set(Bars.High[0], UpbarColour);
// plotLow.Set(Bars.Low[0], UpbarColour);
// plotClose.Set(Bars.Close[0], UpbarColour);
}
else{
if (this.CrossesUnder(m_dirmovement1.DMIPlus, m_dirmovement1.DMIMinus))
{
Alerts.Alert("Bearish alert");
// plotOpen.Set(Bars.Open[0], DownBarColour);
// plotHigh.Set(Bars.High[0], DownBarColour);
// plotLow.Set(Bars.Low[0], DownBarColour);
// plotClose.Set(Bars.Close[0], DownBarColour);
}
}
}
}
}
}


I tried to SetPlotColor and PlotPaintBar and do not get
By the way I use multicharts.net
Can you help me? Thank you


Category MultiCharts 
 
Suggest other entries I might like
Details: DMI change bar color
Category: MultiCharts 


November 16th, 2015
Size: 14.72 KB
Downloaded: 90 times
 


 
Category
 



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.