Orders Execution
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
10.00 %
Total Trades
8
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-1.24
Gross Profit
1.10
Gross Loss
-11.00
Total Net Profit
-9.90
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
1.00 %
Total Trades
7
Won Trades
5
Lost trades
2
Win Rate
0.71 %
Expected payoff
-3.77
Gross Profit
0.40
Gross Loss
-26.80
Total Net Profit
-26.40
-100%
-50%
0%
50%
100%
NZD/USD
Oct 2024 - Jan 2025
20.00 %
Total Trades
8
Won Trades
7
Lost trades
1
Win Rate
0.88 %
Expected payoff
-1.19
Gross Profit
2.40
Gross Loss
-11.90
Total Net Profit
-9.50
-100%
-50%
0%
50%
100%
GoldenCross
//+------------------------------------------------------------------+
//| CCI.mq4 |
//| Lowphat Copyright © 2005 |
//| Golden Cross |
//+------------------------------------------------------------------+
#property copyright "Simple code by Lowphat Copyright © 2005"
#property link "lazersatan@yahoo.com msnger only"
#define MAGIC 654654
extern double smallma = 50;
extern double bigma = 200;
extern double MinutesBetweenOrders = 120;
extern double MAperiod = 50;
extern double StopLoss = 97;
extern double TakeProfit = 50;
extern double TrailingStop = 0;
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 = "MA Cross";
extern int Slippage = 5;
extern bool UseSound = True;
extern string NameFileSound = "alert.wav";
extern double Lots = 0.10;
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(TakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(TakeProfit<10){
Print("TakeProfit less than 10");
return(0);
}
double xma;
double xma1;
double xma2;
double xma3;
double yma;
double yma1;
double yma2;
double yma3;
xma=iMA(NULL,0,smallma,MODE_EMA,0,PRICE_CLOSE,0); //If this is not in use its for future use
xma1=iMA(NULL,0,smallma,MODE_EMA,0,PRICE_CLOSE,1); //If this is not in use its for future use
xma2=iMA(NULL,0,smallma,MODE_EMA,0,PRICE_CLOSE,2); //If this is not in use its for future use
xma3=iMA(NULL,0,smallma,MODE_EMA,0,PRICE_CLOSE,3); //If this is not in use its for future use
yma=iMA(NULL,0,bigma,MODE_EMA,0,PRICE_CLOSE,0); //If this is not in use its for future use
yma1=iMA(NULL,0,bigma,MODE_EMA,0,PRICE_CLOSE,1); //If this is not in use its for future use
yma2=iMA(NULL,0,bigma,MODE_EMA,0,PRICE_CLOSE,2); //If this is not in use its for future use
yma3=iMA(NULL,0,bigma,MODE_EMA,0,PRICE_CLOSE,3); //If this is not in use its for future use
static datetime lastordertime= 0;
int sometimelimit= MinutesBetweenOrders * 60; // don't re-order within 10 minutes
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
if (!ExistPositions()){
if ((xma2<yma2 && xma1>yma1 && Close[1]<Close[0] && CurTime()-lastordertime > sometimelimit)){
OpenBuy();
lastordertime= CurTime();
return(0);
}
if ((xma2>yma2 && xma1<yma1 && Close[1]>Close[0] && CurTime()-lastordertime > sometimelimit)){
OpenSell();
lastordertime= CurTime();
return(0);
}
}
if (ExistPositions()){
if(OrderType()==OP_BUY){
if ((Bid!=Bid)){ //To be determined
CloseBuy();
return(0);
}
}
if(OrderType()==OP_SELL){
if ((Bid!=Bid)){//To be determined
CloseSell();
return(0);
}
}
}
TrailingPositionsBuy(TrailingStop);
TrailingPositionsSell(TrailingStop);
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 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 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 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-StopLoss*Point);}
double GetStopLossSell() { return(Ask+StopLoss*Point); }
double GetTakeProfitBuy() { return(Ask+TakeProfit*Point); }
double GetTakeProfitSell() { return(Bid-TakeProfit*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
---