Profit factor:
0.47

This script is an automated trading system designed to manage market positions based on a multi-layered analysis of price trends and momentum. It operates by monitoring several technical indicators simultaneously to determine the best time to enter, modify, or exit trades.

Core Trading Philosophy

The logic is built upon a "Triple Screen" concept. Instead of looking at just one price movement, the script analyzes three different layers of market data:

  1. Momentum: It tracks the direction of moving averages to identify the current "flow" of the market.
  2. Force: It measures the strength of the price action (the "Force") to ensure that a trade is only taken when there is sufficient power behind the move.
  3. Price Structure: It looks at previous highs and lows to establish specific entry points.

Key Functional Components

1. Dynamic Position Sizing The script includes a smart money management feature. Rather than trading the same amount every time, it calculates the number of "Lots" (the size of your trade) based on your current account balance. This allows the system to scale its exposure as your account grows, maintaining a consistent level of risk.

2. Entry Logic and Pending Orders The script primarily uses "Pending Orders" (Buy Stop and Sell Stop). Instead of entering a trade immediately at the current price, it places an order to be triggered only if the market reaches a specific "breakout" level.

  • Buy Orders: These are placed when the momentum indicators are positive but the "Force" is currently leaning bearish. It waits for the price to break above a recent high point before entering.
  • Sell Orders: These are placed when momentum is negative while the "Force" leans bullish, waiting for the price to drop below a recent low point.
  • Safety Buffers: The script ensures that these entry points are kept at a minimum distance from the current market price to avoid being triggered by minor price fluctuations (noise).

3. Active Trade Management Once a trade is live, the script doesn't leave it alone. It performs two main tasks:

  • Trailing Stop Loss: To protect profits, the script "trails" the stop-loss order. As the price moves in your favor, the stop-loss automatically moves up (for buys) or down (for sells) to lock in gains while still allowing the trade room to continue running.
  • Order Maintenance: The script constantly scans active pending orders. If market conditions shift significantly against the intended direction of an order, it can delete those pending orders to prevent them from being triggered in an unfavorable environment.

4. Automated Updates The system is designed to refresh its calculations at the start of every new candle (time bar). It updates all data—including the current high, low, and moving averages—to ensure that every decision it makes is based on the most recent market information available.

Price Data Components
Series array that contains open time of each barSeries array that contains open prices of each barSeries 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 can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
MACD HistogramMoving Average of OscillatorForce index
19 Views
1 Downloads
0 Favorites
TSD(x)
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

/*[[
	Name := TDSGlobal
	Author := Copyright © 2005 Bob O'Brien / Barcode, Modified by Frank Chamanara(to be run on a 4hr chart)
	Link := 
	Notes := Based on Alexander Elder's Triple Screen system, Weekly System.
]]*/

//+------------------------------------------------------------------+
//|  External Variables                                              |
//+------------------------------------------------------------------+

extern int Lots = 1;
extern int TakeProfit = 50;
extern int Stoploss = 25;
extern int TrailingStop = 20;	
extern int Slippage=5;			// Slippage
//+------------------------------------------------------------------+
//|   Internal Variables                                             |
//+------------------------------------------------------------------+

int BuyEntryOrderTicket=0,SellEntryOrderTicket=0,cnt=0,total=0,h,m,risk=20;

double MacdCurrent=0, MacdPrevious=0, MacdPrevious2=0, Direction=0, OsMAPrevious=0, OsMAPrevious2=0, OsMADirection=0;
double O1,H1,L1,newbar=0;
double PriceOpen=0,lotMM;
double ForcePos=0, ForceNeg=0, Force=0,NewPrice=0;						

bool First=True;
bool hasatrade=false;

datetime prevtime=0;

int start()
{

// initial data checks

   if(Bars<50)
     {
      Print("bars less than 50");
      return(0);  
     }

	     Comment(Year(),"-",Month(),"-",Day(),"  ",Hour(),":",Minute(),
        "\n","MacdPrevious = ",MacdPrevious,"    OsMAPrevious = ",OsMAPrevious,
        "\n","MacdPrevious2 = ",MacdPrevious2,"   OsMAPrevious2 = ",OsMAPrevious2,
        "\n","Direction = ",Direction,"    OsMADirection = ",OsMADirection,
        "\n",
        "\n","Daily Force = ",Force,
        "\n","Is Force Bullish = ",ForcePos,
        "\n","Is Force Bearish = ",ForceNeg,
        "\n",
        "\n","Total Orders = ",total,
        "\n",
        "\n","Daily Open = ",O1,
        "\n","Daily High = ",H1,
        "\n","Daily Low = ",L1,
        "\n",
        "\n","Current Ask Price + 16 pips = ",Ask+(16*Point),
        "\n","Current Bid Price - 16 pips = ",Bid-(16*Point));  
     
if(prevtime == Time[0]) return(0);      // Always start at the new bar
prevtime = Time[0];

// =================================================================================
// PYRAMIDING - LINEAR
// Money Management risk exposure compounding
// =================================================================================
  lotMM = (MathCeil(AccountBalance() * risk / 20000) / 10);
  if (lotMM < 0.1) lotMM = Lots;
  if (lotMM > 1.0) lotMM = MathCeil(lotMM);

/////////////////////////////////////////////////
//  Pending Order Management
/////////////////////////////////////////////////
total=OrdersTotal();
hasatrade = false;   
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

         if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP)
         {
            hasatrade = true;
				if(OsMADirection == -1)
  				{ 
  				   OrderDelete(OrderTicket());
	        		return(0); 
				} // close for if(Direction == -1)
			} // close for if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP)

         if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP)
         {
            hasatrade = true;
				if(OsMADirection == 1)
  				{ 
  				   OrderDelete(OrderTicket());
	        		return(0); 
				} //close for if(Direction == 1)
			} //close for if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP)


         if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP)
   	   {
				if(High[1] < High[2])
	  			{ 
					if(High[1] > (Ask + 16 * Point))
	  				{ 
	  	   		  OrderModify(OrderTicket(),High[1] + 1 * Point,Low[1] - 1 * Point,OrderTakeProfit(),0,Cyan);
                 return(0);					
	  				} //close for if(High[1] > (Ask + 16 * Point))
	  				else
	  				{
	  				  OrderModify(OrderTicket(),Ask + 16 * Point,Low[1] - 1 * Point,OrderTakeProfit(),0,Cyan);
                 return(0);					
	  				
	  				} //close for else statement
	  			} //close for if(High[1] < High[2])
	  		} //close for if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP)
	  
	      if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP)
   		{
				if(Low[1] > Low[2])
				{ 
					if(Low[1] < (Bid - 16 * Point))
					{
		   		  OrderModify(OrderTicket(),Low[1] - 1 * Point,High[1] + 1 * Point,OrderTakeProfit(),0,Cyan);
                 return(0);					
					} // close for if(Low[1] < (Bid - 16 * Point))
					else
					{
					  OrderModify(OrderTicket(),Bid - 16 * Point,High[1] + 1 * Point,OrderTakeProfit(),0,Cyan);
                 return(0);					
      
					} //close for else statement
				} //close for if(Low[1] > Low[2])
			} //close for if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP)
			
			
} // close for for(cnt=0;cnt<total;cnt++)
      
  if(AccountFreeMargin()<(100*Lots))
    {
     Print("We have no money. Free Margin = ", AccountFreeMargin());    
     return(0);  
    }      
  

     h = TimeHour(CurTime());
     m = TimeMinute(CurTime());
     O1=iOpen(NULL,1440,1);
     H1=iHigh(NULL,1440,1);
     L1=iLow(NULL,1440,1);

     
	  MacdPrevious  = iMACD(NULL,240,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
	  MacdPrevious2 = iMACD(NULL,240,12,26,9,PRICE_CLOSE,MODE_MAIN,2);
	  
	  OsMAPrevious  = iOsMA(NULL,240,12,26,9,PRICE_CLOSE,1);
	  OsMAPrevious2 = iOsMA(NULL,240,12,26,9,PRICE_CLOSE,2);

     Force = iForce(NULL,60,24,MODE_EMA,PRICE_CLOSE,1); 
     ForcePos = iForce(NULL,60,24,MODE_EMA,PRICE_CLOSE,1) > 0;
	  ForceNeg = iForce(NULL,60,24,MODE_EMA,PRICE_CLOSE,1) < 0;

	  
	  if (MacdPrevious > MacdPrevious2) Direction = 1;
	  if (MacdPrevious < MacdPrevious2) Direction = -1;
	  if (MacdPrevious == MacdPrevious2) Direction = 0;
	  
	  if (OsMAPrevious > OsMAPrevious2) OsMADirection = 1;
	  if (OsMAPrevious < OsMAPrevious2) OsMADirection = -1;
	  if (OsMAPrevious == OsMAPrevious2) OsMADirection = 0;
	   

/////////////////////////////////////////////////////////////////
//  Process the next bar details for any possible buy/sell order
/////////////////////////////////////////////////////////////////
if (!hasatrade)   // no open orders
{   
	   
	   if(OsMADirection == 1 && ForceNeg)
		{
			PriceOpen = High[1] + 1 * Point;		// Buy 1 point above high of previous candle
			if(PriceOpen > (Ask + 16 * Point))  // Check if buy price is a least 16 points > Ask
			{
				BuyEntryOrderTicket=OrderSend(Symbol(),OP_BUYSTOP,lotMM,PriceOpen,Slippage,Low[1] - 1 * Point,PriceOpen + TakeProfit * Point,"Buy Entry Order placed at "+CurTime(),0,0,Green);
				return(0);

			} // close for if(PriceOpen > (Ask + 16 * Point))
			else
			{
			   NewPrice = Ask + 16 * Point;
				BuyEntryOrderTicket=OrderSend(Symbol(),OP_BUYSTOP,lotMM,NewPrice,Slippage,Low[1] - 1 * Point,NewPrice + TakeProfit * Point,"Buy Entry Order placed at "+CurTime(),0,0,Green);
				return(0);
			} // close for else statement
	   } // close for if(Direction == 1 && ForceNeg)
     
     
     if(OsMADirection == -1 && ForcePos)
     {
         PriceOpen = Low[1] - 1 * Point;
			if(PriceOpen < (Bid - 16 * Point)) // Check if buy price is a least 16 points < Bid
			{
				SellEntryOrderTicket=OrderSend(Symbol(),OP_SELLSTOP,lotMM,PriceOpen,Slippage,High[1] + 1 * Point,PriceOpen - TakeProfit * Point,"Sell Entry Order placed at "+CurTime(),0,0,Green);
				return(0);
			} // close for if(PriceOpen < (Bid - 16 * Point))
			else
			{
				NewPrice = Bid - 16 * Point;
				SellEntryOrderTicket=OrderSend(Symbol(),OP_SELLSTOP,lotMM,NewPrice,Slippage,High[1] + 1 * Point,NewPrice - TakeProfit * Point,"Sell Entry Order placed at "+CurTime(),0,0,Green);
            return(0);			
			} // close for else statement

      } // close for if(Direction == -1 && ForcePos)

} // end of hasatrade 

/////////////////////////////////////////////////
//  Stop Loss Management
/////////////////////////////////////////////////

  total=OrdersTotal();
  for(cnt=0;cnt<total;cnt++)
  { 
     OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

     if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
    	{
			if(Ask-OrderOpenPrice() > (TrailingStop * Point))
  			{ 
				if(OrderStopLoss() < (Ask - TrailingStop * Point))
				{ 
	   		   OrderModify(OrderTicket(),OrderOpenPrice(),Ask - TrailingStop * Point,Ask + TakeProfit * Point,0,Cyan);
               return(0);					

				} // close for if(OrderStopLoss() < (Ask - TrailingStop * Point))
			} // close for if(Ask-OrderOpenPrice() > (TrailingStop * Point))
		} // close for if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
	
     if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
		{
			if(OrderOpenPrice() - Bid > (TrailingStop * Point))
			{ 
				if(OrderStopLoss() > (Bid + TrailingStop * Point))
				{ 
	   		   OrderModify(OrderTicket(),OrderOpenPrice(),Bid + TrailingStop * Point,Bid - TakeProfit * Point,0,Cyan);
               return(0);					

				} // close for if(OrderStopLoss() > (Bid + TrailingStop * Point))
			} // close for if(OrderOpenPrice() - Bid > (TrailingStop * Point))
		 } // close for if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
		 
}  // close for for(cnt=0;cnt<total;cnt++)
//return(0);
} // close for int start

Profitability Reports

PERFORMANCE BY SYMBOL

Expected payoff

Average expected payoff across the available backtests for each symbol.

Positive Negative
15 reports
GBP/USD Oct 2024 - Jan 2025
0.82
Total Trades 272
Won Trades 159
Lost trades 113
Win Rate 58.46 %
Expected payoff -8.26
Gross Profit 10372.70
Gross Loss -12618.20
Total Net Profit -2245.50
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.70
Total Trades 410
Won Trades 174
Lost trades 236
Win Rate 42.44 %
Expected payoff -13.86
Gross Profit 13034.13
Gross Loss -18715.10
Total Net Profit -5680.97
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.68
Total Trades 453
Won Trades 226
Lost trades 227
Win Rate 49.89 %
Expected payoff -11.58
Gross Profit 11187.30
Gross Loss -16434.30
Total Net Profit -5247.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.64
Total Trades 463
Won Trades 240
Lost trades 223
Win Rate 51.84 %
Expected payoff -12.24
Gross Profit 10126.90
Gross Loss -15796.20
Total Net Profit -5669.30
-100%
-50%
0%
50%
100%
EUR/USD Oct 2025 - Feb 2026
0.54
Total Trades 799
Won Trades 367
Lost trades 432
Win Rate 45.93 %
Expected payoff -10.11
Gross Profit 9429.30
Gross Loss -17508.30
Total Net Profit -8079.00
-100%
-50%
0%
50%
100%
GBP/AUD Oct 2025 - Feb 2026
0.53
Total Trades 878
Won Trades 393
Lost trades 485
Win Rate 44.76 %
Expected payoff -11.09
Gross Profit 11079.14
Gross Loss -20814.21
Total Net Profit -9735.07
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.52
Total Trades 274
Won Trades 134
Lost trades 140
Win Rate 48.91 %
Expected payoff -16.96
Gross Profit 4962.00
Gross Loss -9608.70
Total Net Profit -4646.70
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.51
Total Trades 453
Won Trades 205
Lost trades 248
Win Rate 45.25 %
Expected payoff -14.49
Gross Profit 6948.69
Gross Loss -13513.98
Total Net Profit -6565.29
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.49
Total Trades 491
Won Trades 199
Lost trades 292
Win Rate 40.53 %
Expected payoff -13.03
Gross Profit 6222.80
Gross Loss -12621.60
Total Net Profit -6398.80
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.48
Total Trades 422
Won Trades 172
Lost trades 250
Win Rate 40.76 %
Expected payoff -14.15
Gross Profit 5488.70
Gross Loss -11459.90
Total Net Profit -5971.20
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2025 - Feb 2026
0.37
Total Trades 847
Won Trades 332
Lost trades 515
Win Rate 39.20 %
Expected payoff -11.29
Gross Profit 5608.39
Gross Loss -15169.95
Total Net Profit -9561.56
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.32
Total Trades 309
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -25.73
Gross Profit 3693.30
Gross Loss -11643.40
Total Net Profit -7950.10
-100%
-50%
0%
50%
100%
AUD/USD Oct 2025 - Feb 2026
0.28
Total Trades 703
Won Trades 133
Lost trades 570
Win Rate 18.92 %
Expected payoff -14.08
Gross Profit 3919.10
Gross Loss -13820.50
Total Net Profit -9901.40
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.12
Total Trades 310
Won Trades 80
Lost trades 230
Win Rate 25.81 %
Expected payoff -31.95
Gross Profit 1391.45
Gross Loss -11294.58
Total Net Profit -9903.13
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.11
Total Trades 279
Won Trades 66
Lost trades 213
Win Rate 23.66 %
Expected payoff -35.50
Gross Profit 1266.87
Gross Loss -11170.58
Total Net Profit -9903.71
-100%
-50%
0%
50%
100%

Comments