+1 888 340 6572
MultiCharts Project Management
previous_open_issue.png
Go to the previous open issue
previous_issue.png
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
feature_request_small.png
Open Feature request MC-1970

DMI change bar color

action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
next_issue.png
Go to the next issue (open or closed)
next_open_issue.png
Go to the next open issue
Description

Quiero modificar el codico de DMI para cambiar color barra actual cuando haya cruce entre DM+ DM- en subida (azul) y bajada (rojo). El resto de barras siguen siendo de color negro. ver codigo (no funciona)
        
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);
}
         }
       }
}
   }
}
He probado con SetPlotColor y PlotPaintBar y no lo consigo
Por cierto utilizo multicharts.net
Me pueden ayudar? Gracias

Steps to reproduce this issue

Quiero modificar el codico de DMI para cambiar color barra actual cuando haya cruce entre DM+ DM- en subida (azul) y bajada (rojo). El resto de barras siguen siendo de color negro. ver codigo (no funciona)
              
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);
}
                }
            }
}
    }
}
He probado con SetPlotColor y PlotPaintBar y no lo consigo
Por cierto utilizo multicharts.net
Me pueden ayudar? Gracias

Comments (1)
#0
user-offline.png  Alex MultiCharts (Alex MultiCharts)
Jan 15, 2016 - 11:17

Please specify the desription in English, as other languages are not supported.

History
Issue basics
  • Type of issue
    Feature request
  • Category
    Performance
  • Targeted for
    Not determined
  • Status
    Under Review
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (2)
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Resolution
    Not determined
  • Severity
    Normal
Attachments (1)
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates