HI_Line_E_RSI_2

Author: Copyright � 2009, Helen_Iv
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Relative strength index
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
6.00 %
Total Trades 10
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -239.56
Gross Profit 164.10
Gross Loss -2559.70
Total Net Profit -2395.60
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
50.00 %
Total Trades 19
Won Trades 10
Lost trades 9
Win Rate 0.53 %
Expected payoff -41.55
Gross Profit 797.20
Gross Loss -1586.70
Total Net Profit -789.50
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
2.00 %
Total Trades 13
Won Trades 3
Lost trades 10
Win Rate 0.23 %
Expected payoff -293.22
Gross Profit 58.80
Gross Loss -3870.70
Total Net Profit -3811.90
-100%
-50%
0%
50%
100%
HI_Line_E_RSI_2
//+------------------------------------------------------------------+
//|                                  Helen_Iv_Line_Experts_RSI_2.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Helen_Iv"
#property link      "http://helenclubfinance.com"

//---- input parameters
extern double Lots=0.1;

extern int p=23;

extern int TakeProfit = 980;

int BuyTicket,SellTicket;
int StLevel2;
double slts,tpts;
datetime prevtimecalc=0;
int OpenBuy=0, OpenSell=0, CloseBuy=0, CloseSell=0;
int Spread;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   double DeltaTakeStopMin, DeltaFreezeLevel;
   Spread = MarketInfo (Symbol(), MODE_SPREAD);
   
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

int start()
{

   CalcCloseOpen();      

   int total=OrdersTotal();
   int NP=0;
   for(int x=total; x>=0; x--)
      {
      if (!OrderSelect(x, SELECT_BY_POS, MODE_TRADES))continue;
      // Çàêðûòèå îòêðûòûõ ïîçèöèé
      if (OrderType()==OP_BUY && CloseBuy==1){Close_Order(); continue;}
      if (OrderType()==OP_SELL && CloseSell==1) {Close_Order(); continue;}
      // èñêëþ÷àåì îòêðûòèå íåñêîëüêèõ îðäåðîâ íà ñèãíàëå îäíîì áàðà
      if (OrderType()==OP_BUY && OrderOpenPrice()>=Time[0]) NP++;
      if (OrderType()==OP_SELL && OrderOpenPrice()>=Time[0]) NP++;
      }

   if (NP == 0) Open_Buy_Sell ();
           
   return(0);
}
//+------------------------------------------------------------------+
// âû÷èñëèì óñëîâèÿ íà çàêðûòèå è îòêðûòèå ïîçèöèé
//+------------------------------------------------------------------+

void CalcCloseOpen()
{
   //Comment("000Buy - ", OpenBuy, " 000Sell - ", OpenSell);
   if (prevtimecalc==Time[0])return; else prevtimecalc=Time[0];
   OpenBuy=0; OpenSell=0; CloseBuy=0; CloseSell=0;    

   double t2=iRSI(NULL,0,p,PRICE_CLOSE,1);
   double t22=iRSI(NULL,0,p,PRICE_CLOSE,2);
   
   if (t2>30.0&&t22<30.0&&t2>t22&&t2>30.0) {OpenBuy=1; CloseSell=1;} 
   if (t2<70.0&&t22>70.0&&t2<t22&&t2<70.0) {OpenSell=1; CloseBuy=1;} 
   //Comment("Buy - ", OpenBuy, " Sell - ", OpenSell);
   return;
}      


//+------------------------------------------------------------------
//|  Çàêðûòèå ïîçèöèé
//+------------------------------------------------------------------

void Close_Order ()
   {

    if(OrderType()==OP_BUY)
      {
          //Îáåñïå÷èâàåì ïàóçó ìåæäó îïåðàöèÿìè
          //Pause();
          OrderClose(OrderTicket(),OrderLots(),Bid,Spread,Yellow);
          //TradeIsNotBusy();
      }      

    if(OrderType()==OP_SELL)
      {
          //Îáåñïå÷èâàåì ïàóçó ìåæäó îïåðàöèÿìè
          //Pause();
          OrderClose(OrderTicket(),OrderLots(),Ask,Spread,Yellow);
          //TradeIsNotBusy();
      }      
   }
   
//+------------------------------------------------------------------
//|  Îòêðûòèå ïîçèöèé ðûíî÷íûìè îðäåðàìè
//+------------------------------------------------------------------

void Open_Buy_Sell ()

{
   // BUY
   // Open=Ask, Take =Open+Profit, Stop = Open-Spred-stop 
   if(OpenBuy !=0)
      {      		
      // îáíîâëÿåì ðûíî÷íóþ èíôîðìàöèþ
      if (!IsTesting() && !IsOptimization( )) RefreshRates();
      OrderSend(Symbol(),OP_BUY,Lots,Ask,Spread,0,Ask + TakeProfit*Point,0,0,0,Blue);
      if(GetLastError()==0){OpenBuy=0; return;}
      }
   // SELL
   // Open = Bid, Take =Open-Profit, Stop=Open+Spred+Stop
   
   if( OpenSell !=0)
      {      		
      if (!IsTesting() && !IsOptimization( )) {RefreshRates();}
      OrderSend(Symbol(),OP_SELL,Lots,Bid,Spread,0,Bid - TakeProfit*Point,0,0,0,Red); // èñïîëíÿåì
      if(GetLastError()==0) {OpenSell=0; return;}
      }   
   
   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 ---