Ganbah_tp10_sl22

Author: Copyright 2005, Gordago Software Corp.
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
Miscellaneous
It plays sound alerts
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
29.00 %
Total Trades 2666
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -3.64
Gross Profit 3975.00
Gross Loss -13678.20
Total Net Profit -9703.20
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
8.00 %
Total Trades 898
Won Trades 299
Lost trades 599
Win Rate 0.33 %
Expected payoff -10.81
Gross Profit 897.00
Gross Loss -10602.30
Total Net Profit -9705.30
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
22.00 %
Total Trades 1947
Won Trades 889
Lost trades 1058
Win Rate 0.46 %
Expected payoff -4.99
Gross Profit 2667.00
Gross Loss -12378.60
Total Net Profit -9711.60
-100%
-50%
0%
50%
100%
Ganbah_tp10_sl22
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| Copyright 2005, Gordago Software Corp.                           |
//| http://www.gordago.com/                                          |
//| Done by: Osama Ben Shaban, Email: o_shaban@hotmail.com           |
//| The Method is presented by Ganbah                                |
//+------------------------------------------------------------------+


#property copyright "Copyright 2005, Gordago Software Corp."
#property link      "http://www.gordago.com"

#define MAGIC 943448

extern double lStopLoss = 22;
extern double sStopLoss = 22;
extern double lTakeProfit = 10;
extern double sTakeProfit = 10;
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 = "Generate from Gordago";
extern int Slippage = 1;
extern bool UseSound = True;
extern string NameFileSound = "alert.wav";
extern double Lots = 0.30;


void deinit() {
   Comment("");
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start(){
   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);
   }

   double diRSI0=iRSI(NULL,60,3,PRICE_CLOSE,0);
   double diRSI1=iRSI(NULL,60,3,PRICE_CLOSE,0);

   if(AccountFreeMargin()<(1000*Lots)){
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
   }
   if (!ExistPositions()){

      if ((diRSI0<20)){   
         OpenBuy();
         return(0);
      }

      if ((diRSI1>80)){  
         OpenSell();
         return(0);
      }
   }
   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 ModifyStopLoss(double ldStopLoss) { 
   bool fm;
   fm = OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE); 
   if (fm && 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() { 	return(Lots); } 
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 supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---