This automated trading script is designed to identify and execute trades based on specific momentum shifts in the market. It primarily focuses on recognizing "Double Apex" patterns—which are essentially price movements that create a distinct "peak" or "valley" before reversing direction.
Core Trading Logic
The system functions by monitoring a technical indicator (MACD) to gauge the strength and direction of current price trends. Instead of simply reacting to every small fluctuation, the logic follows a structured multi-step validation process:
1. Trend Monitoring and Filtering The script constantly scans the most recent price data to determine if the market is gaining momentum or slowing down. It uses specific numerical thresholds to filter out "noise," ensuring that it only considers significant movements rather than minor price wobbles.
2. Identifying Reversal Signals (Sell Logic) To find an opportunity to sell, the script looks for a specific sequence of events:
- It first detects a downward movement in momentum.
- It then monitors for a "hook" or a temporary pause where the momentum briefly shifts but fails to maintain strength.
- Once the logic confirms that the price has reached a peak and is likely to head downward, it triggers a Sell order.
3. Identifying Reversal Signals (Buy Logic) Similarly, for buying opportunities, the script looks for the opposite behavior:
- It monitors for upward momentum followed by a temporary pause or "dip."
- When it detects that the price has bottomed out and is poised to head back up, it triggers a Buy order.
Trade Execution and Management
Once the mathematical conditions for a pattern are met, the script automatically handles the technical side of the trade:
- Automatic Entry: The script immediately places an order (Buy or Sell) at the current market price.
- Risk Management: Every trade is automatically equipped with a pre-defined Stop Loss (to limit potential losses) and a Take Profit target (to secure gains).
- Trade Reset: After a trade signal is processed, the script resets its internal memory. This prevents it from entering multiple repetitive trades on the same pattern, ensuring that each new trade is based on a fresh market signal.
Summary for the User
In simple terms, this script acts as a vigilant observer. It watches the "flow" of the market, waits for specific moments where the price appears to be Exhausting itself at a high or low point (the Apex), and then quickly places a trade in the direction of the expected reversal.
//+------------------------------------------------------------------+
//| MacdPatternTrader.mq4 |
//| FORTRADER.RU |
//| http://FORTRADER.RU |
//+------------------------------------------------------------------+
/*
Îáðàáàòûâàåì ïàòòåðí ïðîäîëæåíèÿ òðåíäà. Ðàñøèðåííàÿ âåðñèÿ ñîâåòíèêà ñ àäàïòèâíûìè óðîâíÿìè ñòîï ëîññà, òåéêïðîôèòà,
óïðàâëåíèåì ïîçèöèé äîñòóïíà äëÿ ñêà÷èâàíèÿ â íàøåì íîìåðå 18 íîìåðå æóðíàëà.
Manufacturing double apex double bottom. The expanded version adviser with adaptive levels StopLoss, TakeProfit,
management positions available for download in our room 18 issue of the journal.
Ïðèãëàøàåì àâòîðîâ ñòàòåé ïî òðåéäèíãó!
Original description strategies:
http://www.unfx.ru/strategies_to_trade/strategies_134.php
Ïîäðîáíîå îïèñàíèå ïàðàìåòðîâ ñîâåòíèêà äîñòóïíî â 18 íîìåðå æóðíàëà,
ïðåäëîæåíèÿ è îòçûâû ìû áóäåì ðàäû âèäåòü â íàøåé ýëåêòðîïî÷òå: letters@fortrader.ru
http://www.fortrader.ru/arhiv.php
A detailed description of the parameters adviser available 18 issue of the journal.,
suggestions and feedback we will be glad to see in our e-mail: letters@fortrader.ru
http://www.fortrader.ru/arhiv.php
Looking for an interpreter for the English version of the magazine on partnership.
*/
#property copyright "FORTRADER.RU"
#property link "http://FORTRADER.RU"
int buy,sell;int nummodb,nummods;int flaglot,bars_bup;
int start()
{
Comment("FORTRADER.RU");
AOPattern();
return(0);
}
int aop_maxur,aop_minur,aop_oksell,aop_okbuy,S,S1,H,H2,bS,bS1,bH,bH2,stops,stops1,sstops,sstops1;
double max1,max2,max3,min1,min2,min3;
int AOPattern()
{
//çàãðóæàåì èíäèêàòîðû
double macdcurr =iMACD(NULL,0,13,5,1,PRICE_CLOSE,MODE_MAIN,1);
double macdlast =iMACD(NULL,0,13,5,1,PRICE_CLOSE,MODE_MAIN,2);
double macdlast3 =iMACD(NULL,0,13,5,1,PRICE_CLOSE,MODE_MAIN,3);
if(macdcurr<-0.0015 && stops1==0){stops1=1;}
if(macdcurr>-0.0005 && stops1==1){stops1=0;S1=1;}
if(S1==1 && macdcurr<macdlast && macdlast>macdlast3 && macdcurr<-0.0005 && macdlast>-0.0005){aop_oksell=1;S1=0;}
if(macdcurr>0 ){stops1=0;aop_oksell=0;S1=0;}
if(aop_oksell==1)
{max1=0;max2=0;max3=0;
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Bid+100*Point,Bid-300*Point,"FORTRADER.RU",16385,0,Red);
aop_oksell=0;
aop_maxur=0;
nummods=0;
flaglot=0;
bars_bup=0;
stops1=0;aop_oksell=0;S1=0;
}
if(macdcurr>0.0015 && stops==0){stops=1;}
if(macdcurr<0 ){stops=0;aop_okbuy=0;S=0;}
if(macdcurr<0.0005 && stops==1){stops=0;S=1;}
if(S==1 && macdcurr>macdlast && macdlast<macdlast3 && macdcurr>0.0005 && macdlast<0.0005){aop_okbuy=1;S=0;}
if(aop_okbuy==1 )
{
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-100*Point,Ask+300*Point,"FORTRADER.RU",16385,0,Red);
aop_okbuy=0;
aop_minur=0;
nummodb=0;
flaglot=0;
sstops1=0;
min1=0;
min2=0;
min3=0;
}
}
Comments