Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. is there any way to get bordercolor same as candle color using ternary in the code below

is there any way to get bordercolor same as candle color using ternary in the code below

Scheduled Pinned Locked Moved C#
2 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    j k Nov2023
    wrote on last edited by
    #1

    namespace ATAS.Indicators.Technical
    {
    using System;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Windows.Media;

    using ATAS.Indicators.Technical.Properties;
    
    using OFT.Attributes;
    
    \[DisplayName("5.Heiken Ashi Z")\]
    \[Category("# 1234")\]
    public class HeikenAshiz : Indicator
    {
    	private readonly CandleDataSeries \_candles = new CandleDataSeries("Heiken Ashi Z"){ Visible = true };
    	private readonly PaintbarsDataSeries \_bars= new PaintbarsDataSeries("Bars Z"){ Visible = false };
    	public HeikenAshiz()
    	{	
    		Panel = IndicatorDataProvider.NewPanel;
    		DataSeries\[0\]= \_bars;
    		DataSeries.Add(\_candles);
    	}
    
    	protected override void OnCalculate(int bar, decimal value)
    	{
    		var candle = GetCandle(bar);
    		\_bars\[bar\] = Colors.Transparent;
    		if (bar == 0)
    		{
    			\_candles\[bar\] = new Candle()
    			{
    				Close = candle.Close,
    				High = candle.High,
    				Low = candle.Low,
    				Open = candle.Open
    			};
    		}
    		else
    		{
    			var prevCandle = \_candles\[bar - 1\];
    			\_candles\[bar\] = new Candle()
    			{
    				Close = (candle.Open+candle.Close+candle.High+candle.Low)\*0.25m,
    				High = candle.High,
    				Low = candle.Low,
    				Open = (prevCandle.Open+ prevCandle.Close)\*0.5m,
    			};
    		}
    		
    	}
        protected override void OnApplyDefaultColors()
        {
            if (ChartInfo is null)
                return;
    
            \_candles.UpCandleColor = Color.FromRgb(14, 203, 129);
            \_candles.DownCandleColor = Color.FromRgb(246, 70, 93);
            \_candles.BorderColor = Color.FromRgb(127, 127, 127);
        }
    }
    

    }

    L 1 Reply Last reply
    0
    • J j k Nov2023

      namespace ATAS.Indicators.Technical
      {
      using System;
      using System.ComponentModel;
      using System.ComponentModel.DataAnnotations;
      using System.Windows.Media;

      using ATAS.Indicators.Technical.Properties;
      
      using OFT.Attributes;
      
      \[DisplayName("5.Heiken Ashi Z")\]
      \[Category("# 1234")\]
      public class HeikenAshiz : Indicator
      {
      	private readonly CandleDataSeries \_candles = new CandleDataSeries("Heiken Ashi Z"){ Visible = true };
      	private readonly PaintbarsDataSeries \_bars= new PaintbarsDataSeries("Bars Z"){ Visible = false };
      	public HeikenAshiz()
      	{	
      		Panel = IndicatorDataProvider.NewPanel;
      		DataSeries\[0\]= \_bars;
      		DataSeries.Add(\_candles);
      	}
      
      	protected override void OnCalculate(int bar, decimal value)
      	{
      		var candle = GetCandle(bar);
      		\_bars\[bar\] = Colors.Transparent;
      		if (bar == 0)
      		{
      			\_candles\[bar\] = new Candle()
      			{
      				Close = candle.Close,
      				High = candle.High,
      				Low = candle.Low,
      				Open = candle.Open
      			};
      		}
      		else
      		{
      			var prevCandle = \_candles\[bar - 1\];
      			\_candles\[bar\] = new Candle()
      			{
      				Close = (candle.Open+candle.Close+candle.High+candle.Low)\*0.25m,
      				High = candle.High,
      				Low = candle.Low,
      				Open = (prevCandle.Open+ prevCandle.Close)\*0.5m,
      			};
      		}
      		
      	}
          protected override void OnApplyDefaultColors()
          {
              if (ChartInfo is null)
                  return;
      
              \_candles.UpCandleColor = Color.FromRgb(14, 203, 129);
              \_candles.DownCandleColor = Color.FromRgb(246, 70, 93);
              \_candles.BorderColor = Color.FromRgb(127, 127, 127);
          }
      }
      

      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I'll bite. The "border" of what? And if you say window ...

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups