Replies

paul.williams125
13 Aug 2020, 16:28

I mean, it deletes the object,

which automatically calls this :-

        private void OnChartObjectRemoved(ChartObjectRemovedEventArgs args)
        {

         my code

        }

this effects my program


@paul.williams125

paul.williams125
26 Jan 2020, 12:24

RE:
            rsi = Indicators.RelativeStrengthIndex(MarketData.Close, Period, MAType);
            sma = Indicators.SimpleMovingAverage(rsi, Period);

or

               public IndicatorDataSeries dataSeries;

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

               dataSeries = CreateDataSeries();

             rsi = Indicators.RelativeStrengthIndex(MarketData.Close, Period, MAType);

             sma = Indicators.SimpleMovingAverage(dataSeries, Period);

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

          dataSeries[index] = rsi.Result[index];

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

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

This is 5% better.

   public IndicatorDataSeries dataSeries_Ma;

   public IndicatorDataSeries dataSeries_Rsi;

   public MovingAverage  _ma;

   public RelativeStrengthIndex _rsi;

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

               dataSeries_Ma = CreateDataSeries();

               dataSeries_Rsi = CreateDataSeries();

             _rsi = Indicators.RelativeStrengthIndex(dataSeries_Rsi, Period, MAType);

             _ma = Indicators.MovingAverage(dataSeries_Ma, Period, MAType);

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

              dataSeries_Rsi[index] = (MarketSeries.Close + MarketSeries.Open) / 2

              dataSeries_Ma[index] = rsi.Result[index];

 

(close + open /2 ) is better because close, swings about a lot,  high and low is noise

I want to write an algo that smooths the price, using price action patterns ,  lots of moves stored - just like a computer that plays chess. nearly there...


@paul.williams125

paul.williams125
03 Dec 2019, 19:56

PRESS BUTTON - TO RUN MORE THAN ONE EVENT

//-----------------------------------------------------------
//           PRESS BUTTON - TO  RUN MORE THAN ONE EVENT
//-----------------------------------------------------------

// ---------- This to be added just before protected override void Initialize() and OnStart()  below The Declaration of supplementary objects and variables Area.

        int x =0;

        public event Action On;
        public event Action Off;

//-----------------------------------------------------------
//----------- This code must be added Only to - protected override void Initialize() and OnStart() otherwise freezes - for good reason..
            var buttonStyle = new Style();
            buttonStyle.Set(ControlProperty.BackgroundColor, Color.Red, ControlState.DarkTheme);
            buttonStyle.Set(ControlProperty.BackgroundColor, Color.Green, ControlState.DarkTheme | ControlState.Checked);
            var checkBox = new CheckBox 
            {
                Style = buttonStyle,
                Width = 50,
                Height = 200,
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = 5,
                Padding = "10 4 10 4"
            };
            checkBox.Checked += args => On.Invoke();
            On += () =>
            {
                x = 2;
                if (x == 2)
                    Chart.DrawStaticText("NOTES3", "\nHELLO ", VerticalAlignment.Top, HorizontalAlignment.Center, Color.White);
//-----------write your code. for when the button is clicked on, and turns Green.
            };

            checkBox.Unchecked += args => Off.Invoke();
            Off += () =>
            {
                x = 3;
                if (x == 3)
                    Chart.DrawStaticText("NOTES3", "\nGOODBYE ", VerticalAlignment.Top, HorizontalAlignment.Center, Color.White);
//-----------write your code. for when the button is clicked Off, and turns Red.
//-----------Please note .. you can only use the variables here,  x is only 3 while here, and will not change in your main program, when the button is pressed.
            };

 Chart.AddControl(checkBox);


@paul.williams125