Commentator_v1

Download script
Author: ������ ������
Commentator_v1

This script functions as a comprehensive "Market Commentator," designed to provide traders with a real-time text summary of various technical market conditions. Instead of forcing you to look at multiple complicated charts, it aggregates data from several popular trading indicators and translates their raw numbers into easy-to-read human language directly on your screen.

Here is a breakdown of the logic used by the script:

Core Market Dynamics

  • Trend & Volatility: The script monitors market "noise" and movement strength. It calculates the probability of a trend change based on price volatility and tracks whether the market is showing signs of being over-extended or if a reversal might be approaching from above or below.
  • Overbought/Oversold Detection: By analyzing several different oscillators (like R%, MFI, and CCI), the script identifies "extreme" zones. It alerts you when the price may have reached a potential peak (overbought) or a potential bottom (oversold), suggesting that a correction might be due.

Momentum & Signal Processing

  • Buying and Selling Signals: The script evaluates specific momentum shifts to provide actionable prompts. It looks for "crossover" moments where the speed of price movement changes direction, translating these as specific "Buy" or "Sell" signals.
  • Stochastic Analysis: It compares two different mathematical lines (Main and Signal) within the Stochastic indicator. Depending on which line is leading, it suggests whether the current momentum favors a purchase or a sale.

Advanced Positioning Logic

  • AC Indicator Suite: A significant portion of the logic is dedicated to analyzing price action trends through the "AC" indicator. It performs several checks:
    • It determines if the market is currently in a "Long" or "Short" position based on historical price sequence.
    • It evaluates the direction of the trend over the last few bars to confirm if the current movement is consistent.
    • It combines these findings to provide a sophisticated summary of whether the price action supports a potential long-term hold or a short-term exit.

User Experience

The final output is presented as a clean, organized list of text comments on your chart. Each line corresponds to a different technical perspective:

  1. Stochastic & R%: Immediate momentum and overextended alerts.
  2. MFI & CCI: Volume-weighted strength and price corrections.
  3. DeMarker & ATR: Trend reversals and volatility tracking.
  4. Momentum & AC: The ultimate summary of current positioning and directional bias.

Essentially, this script acts as an automated analyst, scanning the "math" of the market and telling you in plain English what those numbers mean for your trading strategy.

Indicators Used
DeMarker indicatorIndicator of the average true rangeBill Williams Accelerator/Decelerator oscillatorCommodity channel indexMoney flow indexLarry William percent range indicatorStochastic oscillatorMomentum indicator
16 Views
0 Downloads
0 Favorites
Commentator_v1
//+------------------------------------------------------------------+
//|  Àíäðåé Îïåéäà                                 Êîììåíòàòîð       |
//+------------------------------------------------------------------+
#property copyright "Îïåéäà Àíäðåé"
#property link      "itrytobenotlinked"
//----
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("Comentator");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i=0;
   //   Demarker
   double valDem=iDeMarker(NULL, 0, 13, 0);
   string commentDem="DeMarker:    ";
   string commentDemAdd="   Íåò äàííûõ";
//----
   if (valDem < 0.30)
      commentDemAdd= "   Îæèäàåòñÿ ðàçâîðîò öåí Ââåðõ";
   if (valDem > 0.70)
      commentDemAdd=  "   Îæèäàåòñÿ ðàçâîðîò öåí Âíèç";
   commentDem=commentDem + commentDemAdd;
   //ATR
   double valATR=iATR(NULL, 0, 12, 0);
   string commentATR="ATR:           ";
   commentATR=commentATR + "   Âåðîÿòíîñòü ñìåíû òðåíäà " + valATR;
   //AÑ
   string commentAC="AC:            ";
   string commentACAdd="Íåò äàííûõ ";
   string commentACAdd0="Íåò äàííûõ ";
   string commentACAdd1="Íåò äàííûõ ";
   string commentACAdd2="Íåò äàííûõ ";
   double valAC0=iAC(NULL, 0, 0);
   double valAC1=iAC(NULL, 0, 1);
//----   
   if (valAC1 < valAC0)
      commentACAdd="Íå æåëàòåëüíî ïðîäàâàòü";
   if (valAC1 > valAC0)
      commentACAdd="Íå æåëàòåëüíî ïîêóïàòü";
   bool theeRedUpper=true;
   for(i=2; i>=0; i--)
     {
      if(iAC(NULL, 0, i) < iAC(NULL, 0, i+1))
        {
         if(iAC(NULL, 0, i)<=0)
            theeRedUpper=false;
        }
      else
         theeRedUpper=false;
     }
   if (theeRedUpper==true)
      commentACAdd0="Êîðîòêàÿ ïîçèöèÿ";
//----
   bool theeGreenDown=true;
   for(i=2; i>=0; i--)
     {
      if(iAC(NULL, 0, i) > iAC(NULL, 0, i+1))
        {
         if(iAC(NULL, 0, i)>=0)
            theeGreenDown=false;
        }
      else
         theeGreenDown=false;
     }
   if (theeGreenDown==true)
      commentACAdd0="Äëèííàÿ ïîçèöèÿ";
//----
   bool twoRedUpper=true;
   for(i=1; i>=0; i--)
     {
      if(iAC(NULL, 0, i) > iAC(NULL, 0, i+1))
         twoRedUpper=false;
     }
   if (twoRedUpper==true)
      commentACAdd2="Êîðîòêàÿ ïîçèöèÿ";
//----
   bool twoGreenDown=true;
   for(i=2; i>=0; i--)
     {
      if(iAC(NULL, 0, i) < iAC(NULL, 0, i+1))
         twoGreenDown=false;
     }
   if (twoGreenDown==true)
      commentACAdd2="Äëèííàÿ ïîçèöèÿ";
   if (iAC(NULL, 0, 0) < 0)
     {
      if (theeRedUpper==true)
         commentACAdd1="Âîçìîæíà ïîêóïêà, ";
      if (theeGreenDown==true)
         commentACAdd1="Âîçìîæíà ïîêóïêà, ";
      if (twoRedUpper==true)
         commentACAdd2="Âîçìîæíà ïðîäàæà, ";
     }
   if (iAC(NULL, 0, 0) > 0)
     {
      if (theeRedUpper==true)
         commentACAdd1="Âîçìîæíà ïðîäàæà, ";
      if (theeGreenDown==true)
         commentACAdd1="Âîçìîæíà ïðîäàæà, ";
      if (twoGreenDown==true)
         commentACAdd2="Âîçìîæíà ïîêóïêà, ";
     }
   commentAC=commentAC
   + "\n" + "   " +commentACAdd
   + "\n" + "   " + commentACAdd1+ commentACAdd0
   + "\n" + "   " + commentACAdd2
   ;
   //CCI
   double valCCI=iCCI(NULL,0,12,PRICE_MEDIAN,0);
   string commentCCI="CCI:            ";
   string commentCCIAdd="   Íåò äàííûõ ";
//----   
   if (valCCI > 100)
      commentCCIAdd= "   Cîñòîÿíèå ïåðåêóïëåííîñòè (âåðîÿòíîñòü êîððåêòèðóþùåãî ñïàäà) ";
   if (valCCI < -100)
      commentCCIAdd= "   Cîñòîÿíèå ïåðåïðîäàííîñòè (âåðîÿòíîñòü êîððåêòèðóþùåãî ïîäúåìà) ";
   commentCCI= commentCCI + commentCCIAdd + valCCI;
   //MFI
   double valMFI=iMFI(NULL,0,14,0);
   string commentMFI="MFI:            ";
   string commentMFIAdd="   Íåò äàííûõ ";
//----   
   if (valMFI > 80)
      commentMFIAdd= "    ïîòåíöèàëüíîàÿ âåðøèíà ðûíêà ";
   if (valMFI < 20)
      commentMFIAdd= "    ïîòåíöèàëüíîàå îñíîâàíèå ðûíêà ";
   commentMFI= commentMFI + commentMFIAdd + valMFI;
   //WPR
   double valWPR=iWPR(NULL,0,14,0);
   string commentWPR="R%:             ";
   string commentWPRAdd="   Íåò äàííûõ ";
//----   
   if (valWPR < -80)
      commentWPRAdd= "    ñîñòîÿíèå ïåðåïðîäàííîñòè (ðàçóìíî äîæäàòüñÿ ïîâîðîòà öåí ââåðõ) ";
   if (valWPR > -20)
      commentWPRAdd= "    ñîñòîÿíèå ïåðåêóïëåííîñòè (ðàçóìíî äîæäàòüñÿ ïîâîðîòà öåí âíèç) ";
   commentWPR= commentWPR + commentWPRAdd + valWPR;
   //STOCH
   double valSTOCH=0;
   string commentSTOCH="Stoch:         ";
   string commentSTOCHAdd="   Íåò äàííûõ ";
//----   
   if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0))
      commentSTOCHAdd= "    Âîçìîæíà ïîêóïêà";
   if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0))
      commentSTOCHAdd= "    Âîçìîæíà ïðîäàæà";
   commentSTOCH= commentSTOCH + commentSTOCHAdd;
   //Momentum
   double valMom=0;
   string commentMom="Momentum:  ";
   string commentMomAdd="   Íåò äàííûõ ";
//----   
   if((iMomentum(NULL,0,14,PRICE_CLOSE,1) < 100) && (iMomentum(NULL,0,14,PRICE_CLOSE,0) > 100))
      commentMomAdd= "    Ñèãíàë ê ïîêóïêå";
   if((iMomentum(NULL,0,14,PRICE_CLOSE,1) > 100) && (iMomentum(NULL,0,14,PRICE_CLOSE,0) < 100))
      commentMomAdd= "    Ñèãíàë ê ïðîäàæå";
   commentMom= commentMom + commentMomAdd;
//----   
   Comment("Èíäèêàòîðû\n"
   +commentSTOCH + "\n"
   +commentWPR + "\n"
   +commentMFI + "\n"
   +commentDem + "\n"
   +commentCCI + "\n"
   +commentATR + "\n"
   +commentMom + "\n"
   +commentAC + "\n"
   );
   return(0);
  }
//+------------------------------------------------------------------+

Comments