MaRsi-Trigger

Author: Copyright � 2010, fx-system@mail.ru
Indicators Used
Moving average indicatorRelative strength index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
MaRsi-Trigger
/*------------------------------------------------------------------+
 |                                              MaRsi-Trigger.mq4   |
 |                                              fx-system@mail.ru   |
 +------------------------------------------------------------------*/
 // ïî ìîòèâàì (ñäåëàí èç) Trinity-Impulse èç CodeBase mql4.com 
 //  àâòîð Trinity-Impulse: basisforex@gmail.com 
 // ??? Ñäåëàòü: äîáàâèòü ñèãíàëû ñ 4÷àñà è Daily 
 //              ñî ñòàðøèõ ÒÔ åùå è ñ âåñàìè???
 // ???          äîáàâèòü PriceAction-òðåíä è ñèãíàë îò ðåãðåññèè
#property copyright "Copyright © 2010, fx-system@mail.ru"
//----
#property indicator_separate_window
//----
#property indicator_buffers 1
#property indicator_color1 Red
//----
extern int nPeriodRsi = 3;
extern int nPeriodRsiLong = 13;
extern int nPeriodMa = 5;
extern int nPeriodMaLong = 10;
//extern int nPeriodADX = 8;
//extern int nLevelADX  = 21;
extern int SetPorog = 0; // ìåíÿåì >0 òîëüêî, åñëè äîáàâèòü ñèãíàëû îò Cci, St, MACD, ...
//----
double c[];
double iCF[];
//+------------------------------------------------------------------+
int init()
 {
   string short_name;
   IndicatorBuffers(2);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, iCF);
   SetIndexBuffer(1, c);
   short_name = "MaRsi-Trigger("+nPeriodMa+"/"+nPeriodMaLong+";"+nPeriodRsi+"/"+nPeriodRsiLong+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0, short_name);
   SetIndexDrawBegin(0, nPeriodRsi);
   return(0);
 }
//+------------------------------------------------------------------+
int start()
 {
   int counted_bars = IndicatorCounted();
   int j, iPorog;
//   int kfADX = 1;
   j = Bars - nPeriodRsi - 1;
   if(counted_bars >= nPeriodRsi) j = Bars - counted_bars - 1;
   // çàùèòà ïîðîãà (íå áîëåå ÷èñëà ñèãíàëîâ)
   iPorog=SetPorog; // åñëè ïîÿâÿòñÿ âíóòðåííèå ìîòèâû èçìåíåíèÿ
   if (SetPorog > 2) iPorog = 0;
   while(j >= 0)
    {
       // Ma
       if (iMA(NULL,0,nPeriodMa,0,MODE_EMA,PRICE_CLOSE,j) > iMA(NULL,0,nPeriodMaLong,0,MODE_EMA,PRICE_CLOSE,j)) c[j] = 1;
       if (iMA(NULL,0,nPeriodMa,0,MODE_EMA,PRICE_CLOSE,j) < iMA(NULL,0,nPeriodMaLong,0,MODE_EMA,PRICE_CLOSE,j)) c[j] = -1;
       // Rsi
       if (iRSI(NULL,0,nPeriodRsi,PRICE_WEIGHTED,j) > iRSI(NULL,0,nPeriodRsiLong,PRICE_MEDIAN,j)) c[j] = c[j] + 1;
       if (iRSI(NULL,0,nPeriodRsi,PRICE_WEIGHTED,j) < iRSI(NULL,0,nPeriodRsiLong,PRICE_MEDIAN,j)) c[j] = c[j] - 1;
       // íîðìèðóåì ñèãíàë??? åñëè ñèãíàëîâ áîëüøå 2-õ
//       if (c[j] > 0) c[j] = 1;
//       if (c[j] < 0) c[j] = -1;
//       if (iADX(NULL,0,nPeriodADX,PRICE_WEIGHTED,MODE_MAIN,j) > nLevelADX) kfADX = 1;
//          else kfADX = 0;
          iCF[j] = 0;
          if(c[j] > iPorog)
           {
             iCF[j] = 1;
           }
          if(c[j] < -1*iPorog) // ??? -1*iPorog åñëè ñèãíàëîâ>2 è ïîðîã íå 0
           {
             iCF[j] = -1;
           }
//           iCF[j] = iCF[j]*kfADX;
       j--;
    }
   return(0);
 }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---