Category Other  Published on 08/06/2023

3 Cloud 3 MA's and Audio

Description

UpDate MA's are now selectable ... Sorry my bad..

RSI Stochastic MACD and 3 MA's with crossover Audio tones.

Ok this is some thing I have been thinking about for some time

And with some help from ( meeting.chegini ) I have made this example

This has 3 clouds like my other's and 3 moving avarages ON Chart all in one

It plays .wav tones from within windows (or your own files)

for MACD crossover and when the fast and medium MA's crossover

AccessRights = AccessRights.None


using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
     [Cloud ( "RSI", "RSI50", Opacity = 0.8 , FirstColor = "RSI", SecondColor = "RSI50")]
      
     [Cloud ( "SCH", "SCH50", Opacity = 0.6 , FirstColor = "SCH", SecondColor = "SCH50")]
     
     [Cloud ( "Macd", "Signal", Opacity = 1 , FirstColor = "Macd", SecondColor = "Signal")]
    
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    
    public class RSMW3T : Indicator
      { 
        public DataSeries Source { get; set; }
   
        [Parameter("RSI Period",Group = "These Defaults are for AUDUSD", DefaultValue = 14)]
        public int RPeriod { get; set; }
        
        [Output("RSI", LineColor = "AA00AA00" )]
        public IndicatorDataSeries RSI { get; set; }
        
        [Output("RSI50", LineColor = "AAFF4400" )]
        public IndicatorDataSeries RSI50 { get; set; }
        
        [Parameter("MaType Smooth",Group = "These Defaults are for AUDUSD")]
        public MovingAverageType MAType { get; set; }
        
        [Parameter("K%",Group = "These Defaults are for AUDUSD", DefaultValue = 14)]
        public int KPeriod { get; set; } 
        
        [Parameter("Slowing",Group = "These Defaults are for AUDUSD", DefaultValue = 3)]
        public int KSlowing { get; set; }
    
        [Parameter("D%",Group = "These Defaults are for AUDUSD", DefaultValue = 3)]
        public int DPeriod { get; set; }
        
        [Output("SCH", LineColor = "AA0000AA" )]
        public IndicatorDataSeries SCH { get; set; }
        
        [Output("SCH50", LineColor = "AAAA0000" )]
        public IndicatorDataSeries SCH50 { get; set; }
        
        [Parameter("Long Cycle",Group = "These Defaults are for AUDUSD", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle",Group = "These Defaults are for AUDUSD", DefaultValue = 12)]
        public int ShortCycle { get; set; }

        [Parameter("Signal Periods",Group = "These Defaults are for AUDUSD", DefaultValue = 9)]
        public int Periods { get; set; }

        [Output("Macd", LineColor = "44FFFF00",Thickness =1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Macd {get;set;}

        [Output("Signal", LineColor = "44AA00FF",Thickness =1, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Signal {get;set;}

        [Parameter("Factor 1 Sets RSI and Stochastic to Close Price ",Group = "These Defaults are for AUDUSD", DefaultValue = 25000)]
        public int F1 { get; set; }
        
        [Parameter("Factor 2 Sets RSI and Stochastic to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 333)]
        public int F2 { get; set; }
        
        [Parameter("Factor 3 Sets Macd to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 100)]
        public int F3 { get; set; }
        
        [Parameter("Factor 4 Sets Macd to Close Price",Group = "These Defaults are for AUDUSD", DefaultValue = 10)]
        public int F4 { get; set; }
        
        [Parameter("Wild Smooth",Group = "These Defaults are for AUDUSD", DefaultValue = 7)]
        public int WS { get; set; }
        
        [Output("Smooth", LineColor = "FF00FF00", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries S { get; set; }
        
        [Parameter("Periods",Group = "These Defaults are for AUDUSD", DefaultValue = 21)]
        public int PF { get; set; }
        [Parameter("MaType Fast",Group = "These Defaults are for AUDUSD")]
        public MovingAverageType MATypeF { get; set; }
        [Output("Wilder 21", LineColor = "FF00FF00", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries FastMa { get; set; }
        
        [Parameter("Periods",Group = "These Defaults are for AUDUSD", DefaultValue = 50)]
        public int PM { get; set; }
        [Parameter("MaType Medi",Group = "These Defaults are for AUDUSD")]
        public MovingAverageType MATypeM { get; set; }
        [Output("Wilder 50", LineColor = "FFFF4400", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries MediMa { get; set; }
        
        [Parameter("Periods",Group = "These Defaults are for AUDUSD", DefaultValue = 200)]
        public int PS { get; set; }
        [Parameter("MaType Slow",Group = "These Defaults are for AUDUSD")]
        public MovingAverageType MATypeS { get; set; }
        [Output("Wilder 200", LineColor = "FF0000FF", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries SlowMa { get; set; }
        
        [Parameter("WWS Tone",Group = "These Defaults are for AUDUSD", DefaultValue = true)]
        public bool DD { get; set; }
        
        [Parameter("Bing Bong",Group = "These Defaults are for AUDUSD", DefaultValue = true)]
        public bool BB { get; set; }
        
        
        private RelativeStrengthIndex rsi;
        
        private StochasticOscillator sch;
        
        private MacdCrossOver macdCrossOver;
        
        MovingAverage Smooth;
        
        MovingAverage Fast;
        MovingAverage Medi;
        MovingAverage Slow;
       
        
        protected override void Initialize()
        {
           rsi = Indicators.RelativeStrengthIndex(Source, RPeriod);
            
           sch = Indicators.StochasticOscillator(KPeriod, KSlowing, DPeriod, MAType);
           
           macdCrossOver = Indicators.MacdCrossOver(LongCycle, ShortCycle, Periods);
           
           Smooth = Indicators.MovingAverage(Source,WS,MAType);
           
           
        Fast = Indicators.MovingAverage(Source,PF,MATypeF);
        Medi = Indicators.MovingAverage(Source,PM,MATypeM);
        Slow = Indicators.MovingAverage(Source,PS,MATypeS);
             
        }
        
        public override void Calculate(int index)
        {
         
         var F = Smooth.Result[index];
         
         var MACD1 = macdCrossOver.MACD.Last(0);
         var Signal1 = macdCrossOver.Signal.Last(0);
         var MACD2 = macdCrossOver.MACD.Last(1);
         var Signal2 = macdCrossOver.Signal.Last(1);
         
         var FAST1 = Fast.Result.Last(0);
         var SLOW1 = Medi.Result.Last(0);
         var FAST2 = Fast.Result.Last(1);
         var SLOW2 = Medi.Result.Last(1);
         
         FastMa[index] = Fast.Result[index];
         MediMa[index] = Medi.Result[index];
         SlowMa[index] = Slow.Result[index];
         
         RSI[index] = rsi.Result[index] / F1 + F - ( F / F2 ) ;
         
         RSI50[index] = F;
         
        
         SCH[index] = sch.PercentK[index] / F1 + F - ( F / F2 ) ;
         
         SCH50[index] = F;
         
         
         Macd[index] = macdCrossOver.MACD[index] * (( F * F3 + F ) * F / F4 ) + F ;

         Signal[index] = macdCrossOver.Signal[index] * (( F * F3 + F ) * F / F4 ) + F ;
         
         S[index] = Smooth.Result[index];
         
         // With some help from this guy >( meeting.chegini ) 
         // I was finaly able to build something different
         // if your reading this you probably already have your own ideas here
         // ....
         // If you use AudaCity (or anything to make .wav files)
         // the next part can be modded with what ever you like.
         // eg; I have made my own wav files that fade in and out
         //  and created a folder to find them in "C:\Users\****\Tones\AUD UP.wav"
         
        if ( BB == true)
         
                  {
                  
          if      (MACD1 > Signal1 && MACD2 < Signal2)
          
                  {
                  BeginInvokeOnMainThread ( () =>
                  { Notifications.PlaySound (@"C:\Windows\Media\Windows Information Bar.wav"); } );
                  }
                  
          else if (MACD1 < Signal1 && MACD2 > Signal2)
                  {
                  BeginInvokeOnMainThread ( () =>
                  { Notifications.PlaySound (@"C:\Windows\Media\Speech Misrecognition.wav"); } );
                  }
                  
                  }
        if ( DD == true)
            {
          if      (FAST1 > SLOW1 && FAST2 < SLOW2)
                  {
                  BeginInvokeOnMainThread ( () => 
                  { Notifications.PlaySound (@"C:\Windows\Media\Windows Information Bar.wav"); } );
                  }
          else    if ((FAST1 < SLOW1) && FAST2 > SLOW2)
                  {
                  BeginInvokeOnMainThread ( () =>
                  { Notifications.PlaySound (@"C:\Windows\Media\Speech Misrecognition.wav"); } );
                  }
                  }
             }
     //
        }
   }


VE
VEI5S6C4OUNT0

Joined on 06.12.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSMW3T.algo
  • Rating: 5
  • Installs: 756
  • Modified: 08/06/2023 08:15
Comments
Log in to add a comment.
VE
VEI5S6C4OUNT0 · 1 year ago

UpDate the MA's are now selectable ... Sorry my bad