CapitalGrid
- Эксперты
- Mr Nisit Noijeam
- Версия: 1.0
- Активации: 10
Code Components and Functionality:
-
Basic Information
- #property : Used to define the EA properties like copyright, link, version, and description.
- input : Parameters that users can customize in the EA, such as enabling/disabling buy/sell orders, price levels, take profit points, lot sizes, etc.
-
Main Functions
- OnInit() : Executes when the EA is initialized. It creates a label on the chart and draws red lines at specified price levels (Red Line).
- OnDeinit(const int reason) : Executes when the EA is deinitialized. It removes the label and red lines from the chart.
- OnTick() : Executes on every new tick. It checks the price and places buy or sell orders based on the specified parameters.
-
Sub-Functions
- CheckAndPlaceOrder() : Checks and places buy or sell orders based on the current price and defined conditions.
- PlaceOrder() : Places a buy or sell order by sending a trade request to the server.
- getLastOrderPrice() : Gets the price of the last opened order.
- IsWithinTradingZone() : Checks if the price is within the specified trading range.
- CountOrders() : Counts the number of orders of a specified type.
- DrawRedLines() : Draws red lines at specified price levels.
- IsOrderInZone() : Checks if there is an existing order in the same zone.
Parameter Descriptions:
- EnableBuy and EnableSell : Enable buy and sell orders.
- RedLinePrice : Price level for the red line.
- RedLineInterval : Interval between red lines in points.
- NumberOfRedLines : Number of red lines to create.
- TakeProfitBuy and TakeProfitSell : Take profit points for buy and sell trades.
- LotSizeBuy and LotSizeSell : Lot sizes for buy and sell trades.
- MaxPriceBuy and MinPriceBuy : Maximum and minimum prices to place buy orders.
- MaxPriceSell and MinPriceSell : Maximum and minimum prices to place sell orders.
- MagicNumber : Magic number for the EA's orders.
- EnableSLBuy and EnableSLSell : Enable stop loss for buy and sell trades.