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

Basic GridManager Library - MetaTrader 5용 라이브러리

조회수:
1043
평가:
(2)
게시됨:
2024.04.12 08:34
업데이트됨:
2024.04.12 09:40
GridTest.mq5 (0.46 KB) 조회
GridManager.mqh (10.41 KB) 조회
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

The library contains basic public methods to manage grids:

public:
                     GridManager(ENUM_GRID_DIRECTION direction, double grid_initial_lot_size, int grid_gap_points, double grid_profit_percent);
                    ~GridManager() {};
   void              SetGridMagicNumber(ulong magic);
   void              SetGridMaxDD(double max_dd_percent);
   void              SetGridMultiplier(double lot_multiplier);
   void              Start(void);
   void              Update(void);
   void              CloseGrid();
   double            GridPnL();
   int               CountPositions();

In above code:

  • MaxDD stands for "maximum allowed drawdown". This value is disabled by default but using the Set method will activate it. This is a value in %balance.
  • Start method starts a new grid if it is not already running.
  • Update checks for new entries and possible exits.

This is a sample code of EA operating based on GridManager Object:

#include <GridManager.mqh>
GridManager *buy_grid;

int OnInit()
  {
   buy_grid = new GridManager(GRID_BUY, 0.01, 100, 1);
   buy_grid.SetGridMagicNumber(100); 
   buy_grid.SetGridMultiplier(1.5); 
   buy_grid.SetGridMaxDD(5);
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {
   delete buy_grid;
  }

void OnTick(void)
  {
   bool buy_condition=true;
   if(buy_condition)
      buy_grid.Start();
   buy_grid.Update();
  }

    A Code block to detect A "New Candle/Bar" using bars history (very effective way) A Code block to detect A "New Candle/Bar" using bars history (very effective way)

    If you only want to execute your code blocks "only once per bar" it's important to check if there is new bar arrived or not.

    Candle Analysis Report Candle Analysis Report

    This script helps traders understand the distribution and range of candles in a specific period, which can be useful for making trading decisions such as determining which historical values to use for Take Profit or Stop Loss.

    Code blocks for "Counters" like Count "X" time and pass Code blocks for "Counters" like Count "X" time and pass

    Here are some examples of codes for set counters based on "Count"

    Simple Yet Effective Breakout Strategy Simple Yet Effective Breakout Strategy

    A simple yet effective donchian channel breakout strategy. This strategy is timeless!