Trailing Stop Management Function – script MetaTrader 5

Trailing Stop Management Function - script for MetaTrader 5
//+——————————————————————+ //|                                       TrailingStopManagement.mq5 | //|                                  Copyright 2023, MetaQuotes Ltd. | //|                                             | //+——————————————————————+ #property copyright “Copyright 2023, MetaQuotes Ltd.” #property link      “” #property version   “1.00” #define _MagicNum  NULL//set magic number input int    Stoplose      =992;// set stoplose value input int    TrailingStop  =986;// set TrailingStop value //+——————————————————————+ //| Script program start function                                    | //+——————————————————————+ void OnStart()   { //—    Management();   } //+——————————————————————+ //+——————————————————————+ //| Management

Calculate Lot Size and Trailling Stop – EA MetaTrader 5

Calculate Lot Size and Trailling Stop - expert for MetaTrader 5
I. Condition Buy-Sell 2. Backtest 1. Main function for calculate lot size //+——————————————————————+ //| caculate lot sisze Function                      | //+——————————————————————+ double calculate_lotsize(double sl, double price)   {   double lots=0.;   double lotstep= SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP); double ticksize = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);    double tickvalue = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);   double balance= AccountInfoDouble(ACCOUNT_BALANCE);   double point= SymbolInfoDouble(_Symbol,SYMBOL_POINT);   //double  loss=MathRound((MathAbs(price-sl)/ ticksize) * ticksize );   double  loss=MathAbs(price-sl)/point;  m_symbol.NormalizePrice(loss);   double Risk= initial_risk*balance;   if(loss!=0)

Trailing stop tutorial using ATR indicator – EA MetaTrader 5

Trailing stop tutorial using ATR indicator - expert for MetaTrader 5
I. Main function 1. Using condition buy or sell base on price action. 2. Auto caculate lot size 3. Auto trailling stop by ATR. 4. Backtest result II. Main function code 1. Trailling and count position function //+——————————————————————+ //|Count position and Trailling Functiom                              | //+——————————————————————+ void  count_position(int &count_buy, int &count_sell, double &_atr[])   {       count_buy=0; count_sell=0;

Lesson 9 Buy sell stop Order – EA MetaTrader 5

Lesson 9 Buy sell stop Order - expert for MetaTrader 5
I. Main function 1. Using condition buy or sell base on price action. 2. Auto caculate lot size 3. Auto trailling stop by ATR. 4. Backtest result II. Main tick function //+——————————————————————+ //| Expert tick function                                             | //+——————————————————————+ void OnTick() {    if(OpenBar(Symbol()))    {    OrderManaging(); // Candle declaration double High[],Low[],open[],close[]; ArraySetAsSeries(High,true);ArraySetAsSeries(Low,true);ArraySetAsSeries(close,true);ArraySetAsSeries(open,true); CopyHigh(Symbol(),timeframe,0,1000,High); CopyLow(Symbol(),timeframe,0,1000,Low);

Code Block for “Trailing Stop” based on current market price. (Ask / Bid) – EA MetaTrader 5

Code Block for "Trailing Stop" based on current market price. (Ask / Bid) - expert for MetaTrader 5
This code block works if you use either a Stop Loss or Not.  Requirements  You need to include “Trade.mqh ” to get access to the CTrade class which allows you to work with positions and orders. #include <Trade\Trade.mqh> // <<—————————————— Include this “Trade.mqh” to access the CTrade Class You need to set an input parameter

Sell with Buy Stop Hedge for chart symbol / Buy with Sell Stop Hedge for chart symbol – script MetaTrader 4

Sell with Buy Stop Hedge for chart symbol / Buy with Sell Stop Hedge for chart symbol - script for MetaTrader 4
It has been over two yeas I don’t use  stop orders much. Instead of placing Stop Loss orders, I use hedged pending orders. I use this scripts often in my trading with keyboard shortcuts ALT+B vs ALT+S, so I think is useful enough to share this scripts with you. #property copyright     “Copyright 2024, MetaQuotes

TradeProtector-1.1 – Automatic Stop Loss and proprotional Trailing Stop (updated version) – EA MetaTrader 4

TradeProtector-1.1 - Automatic Stop Loss and proprotional Trailing Stop (updated version) - expert for MetaTrader 4
Updated version of the: List of fixes: – Added SYMBOL (currency pair) checking. Version 1.0 was processing all orders, no matter what currency pairs was there. Currently this EA is only processing orders of the same symbol. If you want to use it for – let’s say EURGBP and EURUSD – attach trade_protector-1.1 to the

Indicator for Stop Loss levels calculation using Bill Williams technique – indicator MetaTrader 4

Indicator for Stop Loss levels calculation using Bill Williams technique - indicator for MetaTrader 4
Author Vladmir Hlystov An indicator for Stop Loss levels calculation using Bill Willams technique Bill Williams in his book “Trading Chaos: Applying Expert Techniques to Maximize Your Profits” (Chapter 7, Level One: Novice Trader, p.95) has described SL as follows: “…We place the air bag one tick above/below the high/low of the second bar back