Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profitability Reports
NZD/USD
Oct 2024 - Jan 2025
65.00 %
Total Trades
30
Won Trades
23
Lost trades
7
Win Rate
0.77 %
Expected payoff
-72.89
Gross Profit
4076.00
Gross Loss
-6262.60
Total Net Profit
-2186.60
-100%
-50%
0%
50%
100%
ABBMD_GBPJPY
//+------------------------------------------------------------------+
//| Copyright 2005, Larionov P.V. |
//| http:\\www.lolion.narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, Larionov P.V."
#property link "http:\\www.lolion.narod.ru "
#define MAGIC 721328
extern double lStopLoss = 500;
extern double sStopLoss = 500;
extern double lTakeProfit = 40;
extern double sTakeProfit = 40;
extern double lTrailingStop = 500;
extern double sTrailingStop = 500;
extern color clOpenBuy = Blue;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = "ABBMD GBP/JPY";
extern int Slippage = 5;
extern bool UseSound = False;
extern string NameFileSound = "alert.wav";
extern double Lots =0.10;
extern double Margin_Level =500;
extern double WilliamsH1_BUY =10;
extern double WilliamsH1_SELL =-200;
extern double WilliamsM30_BUY =10;
extern double WilliamsM30_SELL =-200;
extern double WilliamsM15_BUY =10;
extern double WilliamsM15_SELL =-200;
extern double WilliamsM5_BUY =-70;
extern double WilliamsM5_SELL =-30;
extern double RSIH1_BUY =75;
extern double RSIH1_SELL =25;
extern double RSIH4_BUY =99;
extern double RSIH4_SELL =11;
extern double RSID1_BUY =99;
extern double RSID1_SELL =11;
extern double MACDH4_BUY_FastEma =15;
extern double MACDH4_BUY_SlowEma =35;
extern double MACDH4_BUY_SMA =12;
extern double MACDH4_SELL_FastEma =15;
extern double MACDH4_SELL_SlowEma =35;
extern double MACDH4_SELL_SMA =12;
extern double MACDD1_BUY_FastEma =15;
extern double MACDD1_BUY_SlowEma =35;
extern double MACDD1_BUY_SMA =12;
extern double MACDD1_SELL_FastEma =15;
extern double MACDD1_SELL_SlowEma =35;
extern double MACDD1_SELL_SMA =12;
extern double BEARS =15;
extern double BULLS =15;
extern double FastMA =24;
extern double SlowMA =24;
extern double CLOSE_FastEma =15;
extern double CLOSE_SlowEma =35;
extern double CLOSE_SMA =12;
extern double CLOSE_RSI_LevelBUY =70;
extern double Close_RSI_LevelSELL =30;
extern double Close_RSI_Period = 21;
extern string _Parameters_b_Lots = "Ïàðàìåòðû ìîäóëÿ ðàñ÷¸òà ëîòà";
extern int LotsWayChoice = 1; // Ñïîñîá âûáîðà ðàáî÷åãî ëîòà:
// 0-ôèêñèðîâàííûé,
// 1-ïðîöåíò îò äåïîçèòà,
// 2-ôðàêöèîííî-ïðîïîðöèîíàëüíûé,
// 3-ôðàêöèîííî-ôèêñèðîâàííûé,
extern int LotsPercent = 40; // Ïðîöåíò îò äåïîçèòà
extern int LotsDeltaDepo = 500; // Êîýôôèöèåíò ïðèðàùåíèÿ äåïîçèòà
extern int LotsDepoForOne = 500; // Ðàçìåð äåïîçèòà äëÿ îäíîãî ìèíèëîòà
extern int LotsMax = 1000; // Ìàêñèìàëüíîå êîëè÷åñòâî ìèíèëîòîâ
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
Print("Account balance = ",AccountBalance());
Print("Point = ",Point);
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(lStopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(lTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
if(sStopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(sTakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
//Indicators on Daily Timeframe ***********************************************************************************
//Buy
double diBullsPower0 =iBullsPower(NULL,1440,BULLS,PRICE_TYPICAL,0);
double diBullsPower24 =iBullsPower(NULL,1440,BULLS,PRICE_TYPICAL,1);
double diMACD1_D1BUY =iMACD(NULL,1440,MACDD1_BUY_FastEma,MACDD1_SELL_SlowEma,MACDD1_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,0);
double diMACD2_D1BUY =iMACD(NULL,1440,MACDD1_BUY_FastEma,MACDD1_SELL_SlowEma,MACDD1_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,1);
//Sell
double diBearsPower8 =iBearsPower(NULL,1440,BEARS,PRICE_TYPICAL,0);
double diBearsPower25 =iBearsPower(NULL,1440,BEARS,PRICE_TYPICAL,1);
double diMACD9_D1SELL =iMACD(NULL,1440,MACDD1_SELL_FastEma,MACDD1_SELL_SlowEma,MACDD1_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,0);
double diMACD10_D1SELL =iMACD(NULL,1440,MACDD1_SELL_FastEma,MACDD1_SELL_SlowEma,MACDD1_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,1);
//Indicators on H4 timeframe ***************************************************************************
//BUY
double diMACD3_H4BUY =iMACD(NULL,240,MACDH4_BUY_FastEma,MACDH4_BUY_SlowEma,MACDH4_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,0);
double diMACD4_H4BUY =iMACD(NULL,240,MACDH4_BUY_FastEma,MACDH4_BUY_SlowEma,MACDH4_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,1);
double diMACD5_H4BUY =iMACD(NULL,240,MACDH4_BUY_FastEma,MACDH4_BUY_SlowEma,MACDH4_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,1);
double diMACD6_H4BUY =iMACD(NULL,240,MACDH4_BUY_FastEma,MACDH4_BUY_SlowEma,MACDH4_BUY_SMA,PRICE_TYPICAL,MODE_MAIN,2);
//SELL
double diMACD11_H4SELL =iMACD(NULL,240,MACDH4_SELL_FastEma,MACDH4_SELL_SlowEma,MACDH4_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,0);
double diMACD12_H4SELL =iMACD(NULL,240,MACDH4_SELL_FastEma,MACDH4_SELL_SlowEma,MACDH4_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,1);
double diMACD13_H4SELL =iMACD(NULL,240,MACDH4_SELL_FastEma,MACDH4_SELL_SlowEma,MACDH4_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,1);
double diMACD14_H4SELL =iMACD(NULL,240,MACDH4_SELL_FastEma,MACDH4_SELL_SlowEma,MACDH4_SELL_SMA,PRICE_TYPICAL,MODE_MAIN,2);
//COMMON INDICATORS
//Indicators on D1 timeframe
double diRSI36_COMD1 =iRSI(NULL,1440,14,PRICE_CLOSE,0);
double diWPR55_COMD1 =iWPR(NULL,1440,15,0);
//Indicators on 4H timeframe
double diRSI18_COMH4 =iRSI(NULL,240,14,PRICE_CLOSE,0);
double diWPR56_COMH4 =iWPR(NULL,240,15,0);
//Indicators on 1H timeframe
double diRSI35_COMH1 =iRSI(NULL,60,14,PRICE_CLOSE,0);
double diWPR37_COMH1 =iWPR(NULL,60,15,0);
//Indicators on 30 min timeframe
double diWPR7_COMM30 =iWPR(NULL,30,15,0);
double diWPR15_COMM30 =iWPR(NULL,30,15,0);
double diRSI30_COMM30 =iRSI(NULL,30,14,PRICE_CLOSE,0);
//Indicators on 15 min timeframe
double diWPR54_COMM15 =iWPR(NULL,15,15,0);
//Indicators on 5 min timeframe
double diWPR55_COMM5 =iWPR(NULL,5,15,0);
double diRSI56_COMM5 =iRSI(NULL,5,14,PRICE_CLOSE,0);
// Closing positions
// At 4H timeframe
double diRSI38_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,0);
double diRSI44_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,1);
double diRSI45_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,2);
double diRSI46_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,3);
double diRSI47_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,4);
double diRSI48_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,5);
double diRSI49_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,6);
double diRSI50_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,7);
double diRSI51_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,8);
double diRSI52_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,9);
double diRSI53_COMH4 =iRSI(NULL,240,Close_RSI_Period,PRICE_TYPICAL,10);
double diMACD39_COMH4 =iMACD(NULL,240,CLOSE_FastEma,CLOSE_SlowEma,CLOSE_SMA,PRICE_TYPICAL,MODE_MAIN,0);
double diMACD40_COMH4 =iMACD(NULL,240,CLOSE_FastEma,CLOSE_SlowEma,CLOSE_SMA,PRICE_TYPICAL,MODE_MAIN,1);
double diMACD41_COMH4 =iMACD(NULL,240,CLOSE_FastEma,CLOSE_SlowEma,CLOSE_SMA,PRICE_TYPICAL,MODE_MAIN,2);
double diMACD42_COMH4 =iMACD(NULL,240,CLOSE_FastEma,CLOSE_SlowEma,CLOSE_SMA,PRICE_TYPICAL,MODE_MAIN,3);
double diMACD43_COMH4 =iMACD(NULL,240,CLOSE_FastEma,CLOSE_SlowEma,CLOSE_SMA,PRICE_TYPICAL,MODE_MAIN,4);
//MA Initialization for close positions 4H timeframe
double diMA28 =iMA(NULL,240,FastMA,0,MODE_EMA,PRICE_CLOSE,0); //fast MA positions closing when fast MA increase slow MA at 4H timeframe or when slow MA increase fast MA
double diMA29 =iMA(NULL,240,SlowMA,0,MODE_EMA,PRICE_CLOSE,0); //slow MA
double diMA31 =iMA(NULL,240,FastMA,0,MODE_EMA,PRICE_CLOSE,1); //
double diMA32 =iMA(NULL,240,SlowMA,0,MODE_EMA,PRICE_CLOSE,1); //
double diMA33 =iMA(NULL,240,FastMA,0,MODE_EMA,PRICE_CLOSE,2); //
double diMA34 =iMA(NULL,240,SlowMA,0,MODE_EMA,PRICE_CLOSE,2); //
if(AccountFreeMargin()<(Margin_Level*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((diBullsPower0 > 0.01 && diMACD1_D1BUY>diMACD2_D1BUY && diRSI36_COMD1 < RSID1_BUY && diMACD3_H4BUY > diMACD4_H4BUY && diMACD5_H4BUY > diMACD6_H4BUY && diRSI18_COMH4 < RSIH4_BUY && diRSI35_COMH1 < RSIH1_BUY && diWPR37_COMH1<WilliamsH1_BUY && diWPR15_COMM30<WilliamsM30_BUY && diWPR54_COMM15<WilliamsM15_BUY && diWPR55_COMM5<WilliamsM5_BUY)){ //&& diMA28>diMA29&& diBullsPower24>0.001 && diWPR7< - 85 && diMACD1>diMACD2
OpenBuy();
return(0);
}
if ((diBearsPower8 < -0.01 && diMACD9_D1SELL<diMACD10_D1SELL && diRSI36_COMD1>RSID1_SELL && diRSI18_COMH4 > RSIH4_SELL && diMACD11_H4SELL<diMACD12_H4SELL && diMACD13_H4SELL < diMACD14_H4SELL && diRSI35_COMH1 > RSIH1_SELL && diWPR37_COMH1>WilliamsH1_SELL && diWPR15_COMM30>WilliamsM30_SELL && diWPR54_COMM15>WilliamsM15_SELL && diWPR55_COMM5>WilliamsM5_SELL )){ // //&& diMA28<diMA29 && diBearsPower25 < -0.001 && diWPR15> -15&& diMACD9<diMACD10
OpenSell();
return(0);
}
}
if (ExistPositions()){
if(OrderType()==OP_BUY){
if ((diMA28<diMA29 && diMA31>=diMA32 && diMA33>diMA34)||((diMACD39_COMH4<diMACD40_COMH4 && diMACD40_COMH4<diMACD41_COMH4 && diMACD41_COMH4 < diMACD42_COMH4) && ( diRSI38_COMH4>CLOSE_RSI_LevelBUY ||diRSI44_COMH4>CLOSE_RSI_LevelBUY ||diRSI45_COMH4>CLOSE_RSI_LevelBUY ||diRSI46_COMH4>CLOSE_RSI_LevelBUY || diRSI47_COMH4>CLOSE_RSI_LevelBUY || diRSI48_COMH4>CLOSE_RSI_LevelBUY || diRSI49_COMH4>CLOSE_RSI_LevelBUY || diRSI50_COMH4>CLOSE_RSI_LevelBUY || diRSI51_COMH4>CLOSE_RSI_LevelBUY || diRSI52_COMH4>CLOSE_RSI_LevelBUY || diRSI53_COMH4>CLOSE_RSI_LevelBUY ))){ // && diMACD42_COMH4 < diMACD43_COMH4 diMACD16<diMACD17 && diMACD17<diMACD26'diMACD16<diMACD17 && diMACD17<diMACD26|| (diRSI18 < diRSI19 && diRSI20 >70 || diRSI21 >70))'
CloseBuy();
return(0);
}
}
if(OrderType()==OP_SELL){
if ((diMA28>diMA29 && diMA31<=diMA32 && diMA33<diMA34)||((diMACD39_COMH4>diMACD40_COMH4 && diMACD40_COMH4>diMACD41_COMH4 && diMACD41_COMH4 > diMACD42_COMH4) && (diRSI38_COMH4 < Close_RSI_LevelSELL ||diRSI44_COMH4 < Close_RSI_LevelSELL ||diRSI45_COMH4<Close_RSI_LevelSELL ||diRSI46_COMH4<Close_RSI_LevelSELL || diRSI47_COMH4<Close_RSI_LevelSELL || diRSI48_COMH4<Close_RSI_LevelSELL || diRSI49_COMH4<Close_RSI_LevelSELL || diRSI50_COMH4<Close_RSI_LevelSELL || diRSI51_COMH4<Close_RSI_LevelSELL || diRSI52_COMH4<Close_RSI_LevelSELL || diRSI53_COMH4>Close_RSI_LevelSELL))){ // && diMACD42_COMH4 > diMACD43_COMH4 diMACD22>diMACD23 && diMACD23>diMACD27
CloseSell();
return(0);
}
}
}
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
return (0);
}
bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
return(True);
}
}
}
return(false);
}
void TrailingPositionsBuy(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
if (OrderType()==OP_BUY) {
if (Bid-OrderOpenPrice()>trailingStop*Point) {
if (OrderStopLoss()<Bid-trailingStop*Point)
ModifyStopLoss(Bid-trailingStop*Point);
}
}
}
}
}
}
void TrailingPositionsSell(int trailingStop) {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) {
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>trailingStop*Point) {
if (OrderStopLoss()>Ask+trailingStop*Point || OrderStopLoss()==0)
ModifyStopLoss(Ask+trailingStop*Point);
}
}
}
}
}
}
void ModifyStopLoss(double ldStopLoss) {
bool fm;
fm = OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);
if (fm && UseSound) PlaySound(NameFileSound);
}
void CloseBuy() {
bool fc;
fc=OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, clCloseBuy);
if (fc && UseSound) PlaySound(NameFileSound);
}
void CloseSell() {
bool fc;
fc=OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, clCloseSell);
if (fc && UseSound) PlaySound(NameFileSound);
}
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
OrderSend(Symbol(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,MAGIC,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossSell();
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
OrderSend(Symbol(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,MAGIC,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot() {
double dLot;
if (LotsWayChoice==0) dLot=Lots;
// ôèêñèðîâàííûé ïðîöåíò îò äåïîçèòà
if (LotsWayChoice==1) {
dLot=MathCeil(AccountFreeMargin()/10000*LotsPercent)/10;
}
// ôðàêöèîííî-ïðîïîðöèîíàëüíûé
if (LotsWayChoice==2) {
int k=LotsDepoForOne;
for (double i=2; i<=LotsMax; i++) {
k=k+i*LotsDeltaDepo;
if (k>AccountFreeMargin()) {
dLot=(i-1)/10; break;
}
}
}
// ôðàêöèîííî-ôèêñèðîâàííûé
if (LotsWayChoice==3) {
dLot=MathCeil((AccountFreeMargin()-LotsDepoForOne)/LotsDeltaDepo)/10;
}
if (dLot<0.1) dLot=0.1;
return(dLot); }
double GetStopLossBuy() { return (Bid-lStopLoss*Point);}
double GetStopLossSell() { return(Ask+sStopLoss*Point); }
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }
double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---