Author: Yuriy Tokman
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
Moving average indicatorRelative strength index
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
25.00 %
Total Trades 100
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -3.14
Gross Profit 104.00
Gross Loss -417.60
Total Net Profit -313.60
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
26.00 %
Total Trades 95
Won Trades 9
Lost trades 86
Win Rate 0.09 %
Expected payoff -2.14
Gross Profit 72.00
Gross Loss -275.20
Total Net Profit -203.20
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
21.00 %
Total Trades 96
Won Trades 12
Lost trades 84
Win Rate 0.13 %
Expected payoff -3.81
Gross Profit 96.00
Gross Loss -462.00
Total Net Profit -366.00
-100%
-50%
0%
50%
100%
Exp_Sidus
//+------------------------------------------------------------------+
//|                                                    Exp_Sidus.mq4 |
//|                                                     Yuriy Tokman |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

extern double TP = 80;
extern double SL = 20;
extern double Lots = 0.1;
extern int shif =1;

 int period_MA1 =5;
 int period_MA2 =12;
 int ma_method =0;//0-4
 int applied_price = 0;//0-6
 int period_RSI = 21;
 int applied_RSI = 0;//0-6

datetime LastTime=0;

int start()
  {
//----
   int cnt, ticket, total;
   
   total=OrdersTotal();
   if(total<1) 
     {
      if(GetSignal()==1 && Time[shif]!= LastTime)
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-SL*Point,Ask+TP*Point,"",28081975,0,Green);
         if(ticket>0)LastTime = Time[shif];
         return(0); 
        }
      if(GetSignal()==-1 && Time[shif]!= LastTime)
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+SL*Point,Bid-TP*Point,"",28081975,0,Red);
         if(ticket>0)LastTime = Time[shif];
         return(0); 
        }
      return(0);
     }      
//----
   for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
        {
         if(OrderType()==OP_BUY)
           {
            if(GetSignal()==-1)
                {
                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                 return(0);
                }
           }
         else 
           {
            if(GetSignal()==1)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
               return(0);
              }
           }
        }
     }   
//----
   return(0);
  }
//+------------------------------------------------------------------+

double GetSignal()
 { 
  double FastEMA=iMA(NULL,0,period_MA1,0,ma_method,applied_price,shif);
  double SlowEMA=iMA(NULL,0,period_MA2,0,ma_method,applied_price,shif);
  double PrevFastEMA=iMA(NULL,0,period_MA1,0,ma_method,applied_price,shif+1);
  double PrevSlowEMA=iMA(NULL,0,period_MA2,0,ma_method,applied_price,shif+1);  
  double rsi= iRSI(NULL,0,period_RSI,applied_RSI,shif);  
 
  int vSig=0;
  if(PrevFastEMA<=PrevSlowEMA && FastEMA>SlowEMA && rsi>50 )vSig = 1;
  else
  if(PrevFastEMA>=PrevSlowEMA && FastEMA<SlowEMA && rsi<50 )vSig =-1;
  return(vSig); 
 }

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