FT_Parabolic SAR_EMA

Author: FORTRADER.RU, ����, ftyuriy@gmail.com
Orders Execution
It automatically opens orders when conditions are reachedIt Closes Orders by itself Checks for the total of open orders
Indicators Used
Parabolic Stop and Reverse systemMoving average indicator
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
3.00 %
Total Trades 18
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -2.32
Gross Profit 1.28
Gross Loss -43.10
Total Net Profit -41.82
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
20.00 %
Total Trades 24
Won Trades 3
Lost trades 21
Win Rate 0.13 %
Expected payoff -3.19
Gross Profit 19.48
Gross Loss -96.07
Total Net Profit -76.59
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
10.00 %
Total Trades 18
Won Trades 2
Lost trades 16
Win Rate 0.11 %
Expected payoff -1.91
Gross Profit 4.02
Gross Loss -38.31
Total Net Profit -34.29
-100%
-50%
0%
50%
100%
FT_Parabolic SAR_EMA
//+------------------------------------------------------------------+
//|                                                FT_Parabolic SAR_EMA.mq4 |
//|                            FORTRADER.RU, Þðèé, ftyuriy@gmail.com |
//|                          http://FORTRADER.RU, Parabolic SAR     + Ñðåäíèå |
//+------------------------------------------------------------------+
#property copyright "FORTRADER.RU, Þðèé, ftyuriy@gmail.com"
#property link      "http://FORTRADER.RU, MACD + Parabolic SAR"

/*Ðàçðàáîòàíî äëÿ 49 âûïóñêà æóðíàëà FORTRADER.Ru. Ñèñòåìà ïî ñðåäíåé è MACD. 
Îò÷åòû: http://finfile.ru/index.php/files/get/EYLOCZ45tW/sarma2.zip, http://finfile.ru/index.php/files/get/f_rINNIekN/sarma.zip
Ñåò ôàéëû:http://finfile.ru/index.php/files/get/hKV6K515_n/sar-ma-eurusd1h.set 
Îáñóæäåíèå:http://fxnow.ru/group_discussion_view.php?group_id=49&grouptopic_id=269&grouppost_id=2682#post_2682 
Àðõèâ æóðíàëà: http://www.fortrader.ru/arhiv.php
49 âûïóñê: http://www.fortrader.ru/
*/

extern int ema1_period = 10 ; 
extern int ema2_period = 25 ; 
extern int ema3_period = 50 ; 

//íàñòðîéêè ïàðàáîëèêà
extern double stepfast=0.02; 
extern double stepfast15m=0.02; 
extern double maximumfast=0.2;

 int SL=1500;
 int TP=1500;
extern int mn=1;
int err;
extern int MG=564651;
extern double Lots=0.01;
extern int maxpos=1;

int bars;
int start()
{
  if(bars!=Bars)
  {   
      bars=Bars;
      OpenPattern();
  }
return(0);
}

int okbuy,oksell;

int OpenPattern()
  {
  double op,sl,tp;
  
   //çàãðóçèì ïàðàáîëèêè
   double fastsar=iSAR(NULL,0,stepfast,maximumfast,1);
   double fastsar15=iSAR(NULL,15,stepfast15m,maximumfast,1);
  
  double ma1=iMA(NULL,0,ema1_period,0,MODE_EMA,PRICE_CLOSE,1);
  double ma2=iMA(NULL,0,ema2_period,0,MODE_EMA,PRICE_CLOSE,1);
  double ma3=iMA(NULL,0,ema3_period,0,MODE_EMA,PRICE_CLOSE,1);
  
  if(ma1<ma2 && ma1<ma3){okbuy=1;}
  if(ma1>ma2 && ma1>ma3){oksell=1;}


  if(oksell==1 && ma1<ma2 && ma1<ma3 && fastsar>Close[1] && fastsar15>Close[1] && CountPos(0)<maxpos )
  {
   op=Bid;if(SL>0){sl=Bid+SL*Point*mn;}if(TP>0){tp=Bid-TP*Point*mn;}
   err=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"4 FORTRADER.RU",MG,0,Red);
   if(err<0){Print("OrderSend()-  Îøèáêà OP_SELL.  op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);}
   oksell=0;
  }
  
  if(okbuy==1 && ma1>ma2 && ma1>ma3  && fastsar<Close[1] && fastsar15<Close[1]  && CountPos(1)<maxpos )
  {
   op=Ask;if(SL>0){sl=Ask-SL*Point*mn;}if(TP>0){tp=Ask+TP*Point*mn;}
   err=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"6 FORTRADER.RU",MG,0,Red);
   if(err<0){Print("OrderSend()-  Îøèáêà OP_BUY.  op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);}
   okbuy=0;
  }
  
  if(ma1<ma2 && ma1<ma3 ){_OrderClose(1);}
  if(ma1>ma2 && ma1>ma3){_OrderClose(0);}
  
 return(err);
 }
  
//Ïðîâåðÿåì êîëè÷åñâòî ïîçèöèé.
int CountPos(int type) 
{//Îïèñàíèå http://fxnow.ru/blog.php?user=Yuriy&blogentry_id=66

int i;
int col;
int count=0 ;
for( i=0; i<=OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && type==1 && OrderMagicNumber()==MG ){count++;}
if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && type==0 && OrderMagicNumber()==MG ){count++;}
}
} 
return(count);
}





int _OrderClose(int type)
   {int err;

   for(int i=1; i<=OrdersTotal(); i++)          
     {
      if (OrderSelect(i-1,SELECT_BY_POS)==true) 
        {
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && type==1 && OrderMagicNumber()==MG )
         {
          err=OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); 
          if(err<0){Print("OrderClose()-  Îøèáêà çàêðûòèÿ OP_BUY.  OrderTicket "+OrderTicket()+" OrderLots() "+OrderLots()+" Bid "+Bid+" "+GetLastError());return(-1);}
         }
         if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && type==0 && OrderMagicNumber()==MG)
         {
          err=OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); 
          if(err<0){Print("OrderClose()-  Îøèáêà çàêðûòèÿ OP_SELL.  OrderTicket "+OrderTicket()+" OrderLots() "+OrderLots()+" Ask "+Ask+" "+GetLastError());return(-1);}
         }
        }
       }
   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 ---