Author: Copyright � 2009, WalkMan.
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Miscellaneous
It issuies visual alerts to the screen
2 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
133.00 %
Total Trades 160
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 0.19
Gross Profit 120.12
Gross Loss -90.05
Total Net Profit 30.07
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
85.00 %
Total Trades 146
Won Trades 64
Lost trades 82
Win Rate 0.44 %
Expected payoff -0.19
Gross Profit 158.39
Gross Loss -186.72
Total Net Profit -28.33
-100%
-50%
0%
50%
100%
TDI_v3
//+------------------------------------------------------------------+
//|                                                          TDI.mq4 |
//|                                       Copyright © 2009, WalkMan. |
//|                                                                  |
//+------------------------------------------------------------------+
//|  Price & Line Type settings:                                     |                
//|   RSI Price settings                                             |               
//|   0 = Close price     [DEFAULT]                                  |               
//|   1 = Open price.                                                |               
//|   2 = High price.                                                |               
//|   3 = Low price.                                                 |               
//|   4 = Median price, (high+low)/2.                                |               
//|   5 = Typical price, (high+low+close)/3.                         |               
//|   6 = Weighted close price, (high+low+close+close)/4.            |
//|                                                                  |
//|   RSI Price Line & Signal Line Type settings                     |
//|   0 = Simple moving average       [DEFAULT]                      |
//|   1 = Exponential moving average                                 |
//|   2 = Smoothed moving average                                    |
//|   3 = Linear weighted moving average                             |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, WalkMan."
#property link      ""
bool Work=true;                    // Ýêñïåðò áóäåò ðàáîòàòü.
extern double Lots = 0.01;
extern int RSI_Period = 13;         //8-25
extern int RSI_Price = 0;           //0-6
extern int Volatility_Band = 34;    //20-40
extern int RSI_Price_Line = 2;      
extern int RSI_Price_Type = 0;      //0-3
extern int Trade_Signal_Line = 7;   
extern int Trade_Signal_Type = 0;   //0-3
extern int slippage = 0;
extern int magic = 123456;
static int prevtime = 0;
static int Sell = 0;
static int Buy = 0;

int init()
  {
     prevtime = Time[0];
   return(0);
}


int deinit()
  {


   return(0);
  }


int start()
  {
  
if (! IsTradeAllowed()) {
      return(0);
   }
   
      if(Work==false)                              // Êðèòè÷åñêàÿ îøèáêà
     {
      Alert("Êðèòè÷åñêàÿ îøèáêà. Ýêñïåðò íå ðàáîòàåò.");
      return;                                   // Âûõîä èç start()
     }  
   
   if (Time[0] == prevtime) {
      return(0);
   }
   prevtime = Time[0];
   
   
 /*  
   Print("Buy =", Buy);
   Print("Sell =", Sell);
   */
   
double RSI = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 4, 0);
double RSI1 = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 4, 1);
double HighLine = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 1, 0);
double HighLine1 = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 1, 1);
double LowLine = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 3, 0);
double LowLine1 = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 3, 1);
double BLine = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 2, 0);
double BLine1 = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 2, 1);
double Signal = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 5, 0);
double Signal1 = iCustom(NULL, 0, "Traders_Dynamic_Index", RSI_Period, RSI_Price, Volatility_Band, RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, 5, 1);

//

if(RSI1>HighLine1 && RSI<HighLine && OrderType()!=OP_SELL && OrdersTotal()<=1)
 {
  Sell=Sell+3;
 } 

if(RSI1<LowLine1 && RSI>LowLine && OrderType()!=OP_BUY && OrdersTotal()<=1)
 {
  Buy=Buy+3;
 }

if(RSI1<Signal1 && RSI>Signal && OrderType()!=OP_BUY && OrdersTotal()<=1)
 {
  Buy=Buy+2;
 }

if(RSI1>Signal1 && RSI<Signal && OrderType()!=OP_SELL && OrdersTotal()<=1)
 {
  Sell=Sell+2;
 }

if(RSI1<BLine1 && RSI>BLine && OrderType()!=OP_BUY && OrdersTotal()<=1)
 {
  Buy=Buy+3;
 }

if(RSI1>BLine1 && RSI<BLine && OrderType()!=OP_SELL && OrdersTotal()<=1)
 {
  Sell=Sell+3;
 }
     
   int ticket = -1;
   int total = OrdersTotal();
   for (int i = total - 1; i >= 0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == magic)) {
         int prevticket = OrderTicket();
             if (Buy >= 5)
    {
     OrderClose(prevticket,OrderLots(),Ask,3,Red);
    }

   if (Sell>= 5)
    {
     OrderClose(prevticket,OrderLots(),Bid,3,Blue);
    }  
        return(0);
      }
   }

          if (Sell >= 5 && OrdersTotal()==0)
           {
            ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,slippage,0,0, WindowExpertName(), magic, 0, Red);
            Sell=0;
           }
          if (Buy >= 5  && OrdersTotal()==0)
           {
            ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,0,0,WindowExpertName(), magic, 0, Blue);
            Buy=0;
           }

   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 ---