거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
Experts

Breakout Strategy with Prop Firm Helper Functions - MetaTrader 5용 expert

조회수:
3215
평가:
(9)
게시됨:
2024.05.11 03:45
업데이트됨:
2024.05.13 07:33
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Hello all,

This is an update of the "Simple Yet Effective Breakout Strategy". In this code, I have added some helper functions for prop firm challenges.

Generally, to pass a prop firm challenge, you need to satisfied three main criterias:

  • Target profit
  • Not violating maximum daily loss
  • Not violating maximum loss

In this code, I have included two functions check for "Target profit" and "Almost violating maximum daily loss" to automatically exit all positions and delete all pending orders. For "maximum loss" it really depends on your strategy and risk management so it won't be mentioned in this MQL5 Script.

//+------------------------------------------------------------------+
//| Prop Firm Helper Functions                                       |
//+------------------------------------------------------------------+

// Delete all pending orders and exit all positions
void ClearAll(string message)
{
   Comment(message);
   for (int i = OrdersTotal() - 1; i >= 0; i--)
   {
      ulong orderTicket = OrderGetTicket(i);
      if (OrderSelect(orderTicket)) 
      {
         trade.OrderDelete(orderTicket);
      }
   }

   for (int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong posTicket = PositionGetTicket(i);
      trade.PositionClose(posTicket);
   }
}

// Check if we have achieved profit target
bool isPassed()
{
   return AccountInfoDouble(ACCOUNT_EQUITY) > PASS_CRITERIA;
}

// Check if we are about to violate maximum daily loss
bool isDailyLimit()
{
   MqlDateTime date_time;
   TimeToStruct(TimeCurrent(), date_time);
   int current_day = date_time.day, current_month = date_time.mon, current_year = date_time.year;
   
   // Current balance
   double current_balance = AccountInfoDouble(ACCOUNT_BALANCE);
   
   // Get today's closed trades PL
   HistorySelect(0, TimeCurrent());
   int orders = HistoryDealsTotal();
   
   double PL = 0.0;
   for (int i = orders - 1; i >= 0; i--)
   {
      ulong ticket=HistoryDealGetTicket(i);
      if(ticket==0)
      {
         Print("HistoryDealGetTicket failed, no trade history");
         break;
      }
      double profit = HistoryDealGetDouble(ticket,DEAL_PROFIT);
      if (profit != 0)
      {
         // Get deal datetime
         MqlDateTime deal_time;
         TimeToStruct(HistoryDealGetInteger(ticket, DEAL_TIME), deal_time);
         // Check deal time
         if (deal_time.day == current_day && deal_time.mon == current_month && deal_time.year == current_year)
         {
            PL += profit;
         }
         else
            break;
      }
   }
   double starting_balance = current_balance - PL;
   double current_equity   = AccountInfoDouble(ACCOUNT_EQUITY);
   return current_equity < starting_balance - DAILY_LOSS_LIMIT;
}

The parameters we need to specify are:

input string dd = "-------------PROP FIRM CHALLENGE-----------------";
input bool   isChallenge = false;
input double PASS_CRITERIA = 110100.;
input double DAILY_LOSS_LIMIT = 4500.;

I hope you find values in this script.


Click on the market chart to create a price alert Click on the market chart to create a price alert

This is a first for MetaTrader 5. Now you can click on the chart to create price alerts.

Lesson 4 Price Action and MA Filter Lesson 4 Price Action and MA Filter

This is a tutorial on price action trading combined with a moving average filter

Basic Library to Create Volume Profiles Basic Library to Create Volume Profiles

Basic library to create Volume Profiles on chart.

Trap News MT5 Trap News MT5

Script For Trap News High Impact