Currencyprofits_01.1

Download script
Author: Testing
Profit factor:
19.45

TrendScalper_TR Logic Overview

This automated trading script is designed to manage trade entries, exits, and risk parameters based on moving average crossovers combined with price action extremes. Below is a non-technical breakdown of how the logic operates.

1. Money and Risk Management

The script begins by determining the position size (number of lots) for each trade. It offers three distinct modes of operation:

  • Fixed Lot Mode: Uses a pre-defined constant lot size regardless of account balance.
  • Fractional Mode: Calculates the lot size based on a percentage of the account balance. This is intended for smaller "mini" accounts.
  • Full Lot Mode: Calculates lot sizes for standard accounts, ensuring the volume scales relative to the total account balance while maintaining specific limits (e.g., capping the maximum number of lots).

2. Active Trade Monitoring and Automated Exits

The script constantly scans all currently open positions on the chart. If a position is already open, it monitors the price to see if it should be closed early based on "breakout" conditions:

  • For Buy Positions: If the current market price rises above the highest point reached in the last 6 bars (excluding the current one), the script will automatically close the trade.
  • For Sell Positions: If the current market price drops below the lowest point reached in the last 6 bars (excluding the current one), the script will automatically close the trade.

This serves as a dynamic exit strategy to secure profits or cut losses when the price reaches a local peak or trough.

3. Entry Strategy

The script only looks to open new trades if there are no existing positions currently active. It uses two primary indicators to confirm an entry: Exponential Moving Averages (EMA) and Simple Moving Averages (SMA), combined with Price Extremes.

Buy Signal Logic:

To open a "Buy" order, the script looks for two conditions to be met simultaneously:

  1. Trend Confirmation: The short-term EMA (6 periods) must be higher than the longer-term SMA (12 periods).
  2. Price Location: The current market price must be at or below the lowest price point of the last 6 bars.

Sell Signal Logic:

To open a "Sell" order, the script looks for two conditions to be met simultaneously:

  1. Trend Confirmation: The short-term EMA (6 periods) must be lower than the longer-term SMA (12 periods).
  2. Price Location: The current market price must be at or above the highest price point of the last 6 bars.

Summary of Behavior

The script acts as a "mean reversion" or "pullback" scalper. It waits for a confirmed trend (via moving averages) and then attempts to enter the market when the price pulls back to a recent extreme low (for buys) or rises to a recent extreme high (for sells). Once a trade is entered, it stays open until the price breaks out past the previous local highs or lows.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
17 Views
0 Downloads
0 Favorites
Currencyprofits_01.1
//+------------------------------------------------------------------+
//|                                              TrendScalper_TR.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Testing"
#property link      "http://www.metaquotes.net/"
//---- input parameters
extern double    LotsIfNoMM=0.1;
extern int       StopLoss=50;
extern int       Slip=5;
extern int       MM_Mode=0;
extern int       MM_Risk=40;
//----
double Opentrades,orders,first,mode,Ilo,sym,b,tmp,GridCellPoint,OpenOrderStopLoss;
double b4signal,Signal,Triggerline,b4Triggerline,Nowsignal,NowTriggerline,sl,LastOpByExpert,LastBarChecked;
int cnt,cnt2,OpenPosition,notouchbar,PendingOrderTicket,OpenOrderTicket;
bool test;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   //return(0);
   //if ( ! IsTesting() ) Comment(" Trailingstop    ",  b, "\n","      Tick no. ", iVolume(NULL,0,0),"\n"," Lots    ",Ilo);
   /**********************************Money and Risk Management***************************************
   Changing the value of mm will give you several money management options
   mm = 0 : Single 1 lot orders.
   mm = -1 : Fractional lots/ balance X the risk factor.(use for Mini accts)
   mm = 1 : Full lots/ balance X the risk factor up to 100 lot orders.(use for Regular accounts)
   ***************************************************************************************************
   RISK FACTOR:
   risk can be anything from 1 up. 
   Factor of 5 adds a lot for every $20,000.00 added to the balance. 
   Factor of 10 adds a lot with every $10.000.00 added to the balance.
   The higher the risk,  the easier it is to blow your margin..
   **************************************************************************************************/
     if (MM_Mode < 0)  
     {
      Ilo=MathCeil(AccountBalance()*MM_Risk/10000)/10;
        if (Ilo > 100) 
        {
         Ilo=100;
        }
      }
       else 
      {
      Ilo=LotsIfNoMM;
     }
   if (MM_Mode > 0)
     {
      Ilo=MathCeil(AccountBalance()*MM_Risk/10000)/10;
      if (Ilo > 1)
        {
         Ilo=MathCeil(Ilo);
        }
      if (Ilo < 1)
        {
         Ilo=1;
        }
      if (Ilo > 100)
        {
         Ilo=100;
        }
     }
   Opentrades=0;
   for(cnt=0;cnt<OrdersTotal();cnt++)
     {
      if(OrderSelect (cnt, SELECT_BY_POS)==false) continue;
      if(OrderSymbol()==Symbol())
        {
         Opentrades=Opentrades+1;
        }
     }
   if (Opentrades!=0)
     {
      if (OrderType()==OP_BUY)
        {
         if (Bid>=iHigh(Symbol(),0,Highest(Symbol(),0,MODE_HIGH,6,1)))
           {
            OrderClose(OrderTicket(),OrderLots(),Bid,Slip,Red);
            Opentrades--;
           }
        }
      else if (OrderType()==OP_SELL)
           {
            if (Bid<=iLow(Symbol(),0,Lowest(Symbol(),0,MODE_LOW,6,1)))
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,Slip,Red);
               Opentrades--;
              }
           }
     }
   if (Opentrades==0)
     {
      if (iMA(Symbol(),0,6,0,MODE_EMA,PRICE_CLOSE,1)>iMA(Symbol(),0,12,0,MODE_SMA,PRICE_CLOSE,1) && Bid<=iLow(Symbol(),0,Lowest(Symbol(),0,MODE_LOW,6,1)))
        {
         OrderSend(Symbol(),OP_BUY,Ilo,Ask,Slip,Ask-StopLoss*Point,0,"CP",0,0,Blue);
        }
      if (iMA(Symbol(),0,6,0,MODE_EMA,PRICE_CLOSE,1)<iMA(Symbol(),0,12,0,MODE_SMA,PRICE_CLOSE,1) && Bid>=iHigh(Symbol(),0,Highest(Symbol(),0,MODE_HIGH,6,1)))
        {
         OrderSend(Symbol(),OP_SELL,Ilo,Bid,Slip,Bid+StopLoss*Point,0,"CP",0,0,Blue);
        }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

PERFORMANCE BY SYMBOL

Expected payoff

Average expected payoff across the available backtests for each symbol.

Positive Negative
16 reports
EUR/USD Jul 2025 - Sep 2025
304.72
Total Trades 648
Won Trades 93
Lost trades 555
Win Rate 14.35 %
Expected payoff 1300.65
Gross Profit 845594.30
Gross Loss -2775.00
Total Net Profit 842819.30
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
0.74
Total Trades 764
Won Trades 186
Lost trades 578
Win Rate 24.35 %
Expected payoff -0.97
Gross Profit 2152.50
Gross Loss -2890.00
Total Net Profit -737.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.69
Total Trades 777
Won Trades 98
Lost trades 679
Win Rate 12.61 %
Expected payoff -0.93
Gross Profit 1578.88
Gross Loss -2303.16
Total Net Profit -724.28
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.68
Total Trades 403
Won Trades 104
Lost trades 299
Win Rate 25.81 %
Expected payoff -1.19
Gross Profit 1014.70
Gross Loss -1495.00
Total Net Profit -480.30
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.67
Total Trades 372
Won Trades 53
Lost trades 319
Win Rate 14.25 %
Expected payoff -1.01
Gross Profit 759.23
Gross Loss -1133.61
Total Net Profit -374.38
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.65
Total Trades 344
Won Trades 81
Lost trades 263
Win Rate 23.55 %
Expected payoff -1.35
Gross Profit 850.50
Gross Loss -1315.00
Total Net Profit -464.50
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.62
Total Trades 411
Won Trades 110
Lost trades 301
Win Rate 26.76 %
Expected payoff -1.39
Gross Profit 935.50
Gross Loss -1505.00
Total Net Profit -569.50
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.52
Total Trades 551
Won Trades 95
Lost trades 456
Win Rate 17.24 %
Expected payoff -1.45
Gross Profit 855.82
Gross Loss -1657.52
Total Net Profit -801.70
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.51
Total Trades 519
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -2.23
Gross Profit 1214.00
Gross Loss -2370.00
Total Net Profit -1156.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.51
Total Trades 575
Won Trades 108
Lost trades 467
Win Rate 18.78 %
Expected payoff -2.49
Gross Profit 1480.62
Gross Loss -2910.79
Total Net Profit -1430.17
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.42
Total Trades 878
Won Trades 105
Lost trades 773
Win Rate 11.96 %
Expected payoff -2.53
Gross Profit 1640.10
Gross Loss -3865.00
Total Net Profit -2224.90
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.25
Total Trades 677
Won Trades 49
Lost trades 628
Win Rate 7.24 %
Expected payoff -3.50
Gross Profit 773.80
Gross Loss -3140.00
Total Net Profit -2366.20
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.11
Total Trades 3514
Won Trades 77
Lost trades 3437
Win Rate 2.19 %
Expected payoff -2.84
Gross Profit 1217.76
Gross Loss -11182.06
Total Net Profit -9964.30
-100%
-50%
0%
50%
100%
GBP/AUD Oct 2025 - Feb 2026
0.09
Total Trades 3139
Won Trades 44
Lost trades 3095
Win Rate 1.40 %
Expected payoff -3.17
Gross Profit 945.59
Gross Loss -10908.55
Total Net Profit -9962.96
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2025 - Feb 2026
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%

Comments