Price Data Components
Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
8.00 %
Total Trades
262
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-2.70
Gross Profit
57.60
Gross Loss
-764.30
Total Net Profit
-706.70
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
15.00 %
Total Trades
260
Won Trades
229
Lost trades
31
Win Rate
0.88 %
Expected payoff
-1.47
Gross Profit
68.70
Gross Loss
-451.20
Total Net Profit
-382.50
-100%
-50%
0%
50%
100%
NZD/USD
Oct 2024 - Jan 2025
6.00 %
Total Trades
250
Won Trades
166
Lost trades
84
Win Rate
0.66 %
Expected payoff
-3.34
Gross Profit
49.80
Gross Loss
-885.90
Total Net Profit
-836.10
-100%
-50%
0%
50%
100%
escape3
//+------------------------------------------------------------------+
//| robotic.mq4 |
//| Copyright © 2008, OGUZ BAYRAM |
//| es_cape77@hotmail.com |
//+------------------------------------------------------------------+
extern int iTakeProfitCloseValue=3;
extern int iTakeProfitMaxDecCount=3;
static bool bTakeProfitPrevious=-1;
static int iTakeProfitDecraeseCount=0;
static int iTakeProfitMaxValue=-1;
extern double lTakeProfit = 3;
extern double sTakeProfit = 3;
extern double lTrailingStop = 20;
extern double sTrailingStop = 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 = "Robotic";
extern int Slippage = 1;
extern bool UseSound = true;
extern bool FractionalPips = true;
extern string NameFileSound = "Alert.wav";
extern double Lots = 0.1;
extern bool reverseLogic = true;
int magic_number = 013113324124;
extern int MA_Period = 14;
extern double b = 0.7;
double CrossUp[];
double CrossDown[];
double MapBuffer;
double e1[],e2[],e3[],e4[],e5[],e6[];
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;
int UP[];
int UP2[];
int UU;
int DD;
double closePosPrice = 0;
int closePosition = -1;
double openPosPrice = 0;
int openPosition = -1;
void init() {
//---- variable reset
//e2=0; e3=0; e4=0; e5=0; e6=0;
c1=0; c2=0; c3=0; c4=0;
n=0;
w1=0; w2=0;
b2=0; b3=0;
b2=b*b;
b3=b2*b;
c1=-b3;
c2=(3*(b2+b3));
c3=-3*(2*b2+b+b3);
c4=(1+3*b+b3+3*b2);
n=MA_Period;
if (n<1) n=1;
n = 1 + 0.5*(n-1);
w1 = 2 / (n + 1);
w2 = 1 - w1;
return(0);
}
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
double SL = 100.0;
int totalOrderCount=OrdersTotal();
for(int pos=0;pos<totalOrderCount;pos++)
{
if( OrderSelect(pos,SELECT_BY_POS)==false ) continue;
//orderý seçtik þu an
if (OrderSymbol() == Symbol()) //bu satýr sadece ea'yý attýðýnýz grafiðin sembolündeki para ile açýlan emirleriniz üzerinde iþlem yapmak için konuldu
{
if ( OrderProfit() > 0 )
{
//TAKE PROFÝT DÜÞMEYE BAÞLARSA KAPAT
//eðer kârdaysak ve peþpeþe iTakeProfitMaxDecCount sayýsýndan daha çok düþüþ yaþamýþsak, (TP: 100, 90, 80, 70 gibi, burada 4 kez düþüþ oldu demektir) pozisyonu hiç gözünün yaþýna bakmadan kapatýr
//fakat kapatabilmek için birde istenilen minimum deðeri geçmiþmi bakýyorum hesabý þöyle (Profit > iTakeProfitCloseValue * 7.0) isterseniz bu kýsýtý kaldýrýn if'den
if (OrderProfit()> iTakeProfitMaxValue)
iTakeProfitMaxValue = OrderProfit();
if (bTakeProfitPrevious > OrderProfit())
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount + 1;
else if (bTakeProfitPrevious < OrderProfit())
{
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount - 1;
if (iTakeProfitDecraeseCount<0)
iTakeProfitDecraeseCount = 0;
}
//Print(Symbol()," TPCount: ",iTakeProfitDecraeseCount);
bTakeProfitPrevious = OrderProfit();
if (( iTakeProfitMaxDecCount <= iTakeProfitDecraeseCount) && (OrderProfit() >= (iTakeProfitCloseValue * 7.0)) )
{
bool cticket;
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," kez düþtü kapattýk. Fiyat:",Ask);
/*if ( OrderType() == OP_BUY )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," kez düþtü kapattýk. Fiyat:",Ask);
cticket = OrderClose(OrderTicket(),OrderLots(),Ask,3,Yellow);
}
if ( OrderType() == OP_SELL )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," kez düþtü kapattýk. Fiyat:",Bid);
cticket = OrderClose(OrderTicket(),OrderLots(),Bid,3,Yellow);
}*/
//yeni close iþlemi
double Price=OrderOpenPrice();
int Ticket=OrderTicket();
double Lot=OrderLots();
//artýk pozisyonu kapatmayý kafaya koyduk hemen kapatýyoruz ama bazen broker kapatmýyor istediðimiz yerden,
//onun için 7 kez peþ peþe deniyoruz
int AttemptCount=0;
while(true)
{
switch(OrderType())
{
case 0: double Price_Cls=Bid;
string Text="Buy ";
break;
case 1: Price_Cls=Ask;
Text="Sell ";
}
//Print("Kapatmaya çalýþýyoruz ",Text," ",Ticket);
bool Ans=OrderClose(Ticket,Lot,Price_Cls,2);
if (Ans==true) // kapantý
{
Print("Kapattýk :) ",Text," ",Ticket," Attemp: ",AttemptCount);
break; //while'ý kýrýyoruz
}
//hata var tekrar deneyelim
Sleep(300);
RefreshRates();
AttemptCount++;
if (AttemptCount > 7) break;
continue;
}//while
}//kapatma if'inin sonu
//BURALAR STOP LOSS AYAR ÝÞLEMLERÝ
//SL YOKSA KOYARMI BÝLMÝYORUM DENEMEDÝM :)),
//BURASI SL'yi eðer kârda ise pozisyon daha iyi yere taþýr sürekli olarak, böylece sert dönüþlerde daha az zarar görmemize yarar
int temp = -1;
if (OrderType() == OP_BUY)
{
double ftemp = SL;
if (Digits > 4)
{
ftemp = ftemp*MathPow(100,(Digits-4));//
} else {
ftemp = ftemp*MathPow(100,(4-Digits));//
}
if ( OrderStopLoss() < (Bid-ftemp*Point) )
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-ftemp*Point,OrderTakeProfit(),0,Blue);
}
temp = GetLastError();
if (temp>0)
{
Print(Symbol()," P: ",Period(),", ORDER DEÐÝÞTÝ HATA - SL: ", Bid-ftemp*Point," Err: ",temp);
}
} else {
double ftemp2 = SL;
if (Digits > 4)
{
ftemp2 = ftemp2*MathPow(100,(Digits-4));//
} else {
ftemp2 = ftemp2*MathPow(100,(4-Digits));//
}
if (OrderStopLoss() > ( Ask+ftemp2*Point ))
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ftemp2*Point,OrderTakeProfit(),0,Blue);
temp = GetLastError();
if (temp>0)
{
Print(Symbol()," P: ",Period(),", ORDER DEÐÝÞTÝ HATA - SL:", Ask+ftemp2*Point," Err: ",temp);
}
}//if orderType
}//if orderprofit
}//if ordersymbol
}//for
if(Bars<100){
Print("bars less than 100");
return(0);
}
if (Digits==3 || Digits==5)
if(lTakeProfit<1){
Print("TakeProfit less than 1");
return(0);
}
if(sTakeProfit<1){
Print("TakeProfit less than 1");
return(0);
}
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
int same , notsame, samef, notsamef, samer, notsamer, samecandle, notsamecandle ;
double GSignalUP=0 , SignalUP=0 , GSignalDOWN=0, SignalDOWN=0 , AllSignal=0 , BSignalUP=0
, BSignalDOWN=0 ;
double samep,notsamep,all,GSignals,GSignalsP, GSignalUPP,GSignalDOWNP,fastMAnow,fastMAprevious,slowMAnow,slowMAprevious;
double FMA1,FMA2,SMA1,SMA2;
string sameforecast,notsameforecast, wajdyssforecast , status ;
// if (manual ==true) status="manual"; else status="auto";
int limit;
int sBars=600;
limit=(sBars)-1;
//---- indicator calculation
ArrayResize(e1, sBars+1);
ArrayResize(e2, sBars+1);
ArrayResize(e3, sBars+1);
ArrayResize(e4, sBars+1);
ArrayResize(e5, sBars+1);
ArrayResize(e6, sBars+1);
ArrayResize(UP, sBars+1);
ArrayResize(UP2, sBars+1);
for (int i=limit;i>=1;i--)
{
e1[sBars-i] = w1*Close[i] + w2*e1[(sBars-i)-1];
e2[sBars-i] = w1*e1[sBars-i] + w2*e2[(sBars-i)-1];
e3[sBars-i] = w1*e2[sBars-i] + w2*e3[(sBars-i)-1];
e4[sBars-i] = w1*e3[sBars-i] + w2*e4[(sBars-i)-1];
e5[sBars-i] = w1*e4[sBars-i] + w2*e5[(sBars-i)-1];
e6[sBars-i] = w1*e5[sBars-i] + w2*e6[(sBars-i)-1];
//Print ("I- ",i, "Bars-I ",Bars-i);
MapBuffer=c1*e6[sBars-i] + c2*e5[sBars-i] + c3*e4[sBars-i] + c4*e3[sBars-i];
//Comment (MapBuffer," ",Close[i]," ",UP[i]);
//if ((Close[i]-5*Point)>MapBuffer && UP[UU]==0) {}
//if ((Close[i]+5*Point)<MapBuffer && UP[UU]==1) {}
if ((Close[i]-5*Point)>MapBuffer && UP[UU]==0)
{UU=i+1; UP[UU]=1;
// {UP[ii]=1; DOWN[i]=0;}
// DOWN[i]=0;
CrossUp[i] = Low[i]-5*Point;
AllSignal++;
SignalUP++;
if (iClose(Symbol(),NULL,i-1)>iOpen(Symbol(),NULL,i-1))
GSignalUP++;
else BSignalUP++;
}
else if ((Close[i]+5*Point)<MapBuffer && UP[UU]==1)
{
UU=i+1; UP[UU]=0;
// DOWN[i]=1;
CrossDown[i] = High[i]+5*Point;
AllSignal++;
SignalDOWN++;
if (iClose(Symbol(),NULL,i-1)<iOpen(Symbol(),NULL,i-1))
GSignalDOWN++;
else BSignalDOWN++;
}
}
int j=1;
i=1;
int date4=TimeMinute(Time[j]);
int date5=TimeDay(Time[j]);
//Comment(UP2[2]);
int date3;
int second=20;
if ((Close[i]-5*Point)>MapBuffer && UP2[2]==0 && date3!=Time[j] && Seconds()<second)
{date3=Time[j]; UP2[2]=1; closePosPrice = iClose(Symbol(),0,i); closePosition = OP_SELL; if (!ExistPositions()){ openPosPrice = iClose(Symbol(),0,i); openPosition = OP_BUY; } }
if ((Close[i]+5*Point)<MapBuffer && UP2[2]==1 && date3!=Time[j] && Seconds()<second)
{date3=Time[j]; UP2[2]=0; closePosPrice = iClose(Symbol(),0,i); closePosition = OP_BUY; if (!ExistPositions()){ openPosPrice = iClose(Symbol(),0,i); openPosition = OP_SELL; } }
if ( closePosition == OP_BUY || closePosition == OP_SELL ) {
if ( closePosition == OP_BUY && Bid <= closePosPrice ) {
CloseOrders(OP_BUY);
} else if ( closePosition == OP_SELL && Ask >= closePosPrice ) {
CloseOrders(OP_SELL);
}
}
if ( openPosition == OP_BUY || openPosition == OP_SELL ) {
if ( openPosition == OP_BUY && Ask <= openPosPrice ) {
OpenBuy();
} else if ( openPosition == OP_SELL && Bid >= openPosPrice ) {
OpenSell();
}
}
GSignals=GSignalUP+GSignalDOWN;
GSignalsP=GSignals/AllSignal;
GSignalUPP=(GSignalUP/SignalUP);
GSignalDOWNP=(GSignalDOWN/SignalDOWN);
int www=GSignalsP*100 ;
/*
double diClose0=iClose(NULL,5,0);
double diMA1=iMA(NULL,5,5,0,MODE_SMA,PRICE_OPEN,1);
double diClose2=iClose(NULL,5,0);
double diMA3=iMA(NULL,5,4,0,MODE_SMA,PRICE_OPEN,1);
if (!ExistPositions()){
if ((diClose0<diMA1)){
if (reverseLogic) OpenSell();
else OpenBuy();
}
if ((diClose2>diMA3)){
if (reverseLogic) OpenBuy();
else OpenSell();
}
}*/
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
return (0);
}
bool ExistPositions() {
for (int i=5; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
}
}
return(false);
}
void TrailingPositionsBuy(int trailingStop) {
for (int i=5; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
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=5; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
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 BuyLimit=0) {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
if ( BuyLimit == 0 ) OrderSend(Symbol(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,magic_number,0,clOpenBuy);
else OrderSend(Symbol(),OP_BUYSTOP,ldLot,BuyLimit,Slippage,ldStop,ldTake,lsComm,magic_number,0,clOpenBuy);
if (UseSound) PlaySound(NameFileSound);
openPosition = -1;
}
void OpenSell(double SellLimit=0) {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = 0;
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
if ( SellLimit == 0 ) OrderSend(Symbol(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,magic_number,0,clOpenSell);
else OrderSend(Symbol(),OP_SELLSTOP,ldLot,SellLimit,Slippage,ldStop,ldTake,lsComm,magic_number,0,clOpenSell);
if (UseSound) PlaySound(NameFileSound);
openPosition = -1;
}
void CloseOrders(int cmd) {
int i = 0;
for (i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i,SELECT_BY_POS) == true && OrderSymbol() == Symbol() && OrderMagicNumber() == magic_number && OrderType() == cmd)
{
if (OrderType() == OP_SELL) {
OrderClose(OrderTicket(),OrderLots(),Ask,0);
} else if (OrderType() == OP_BUY) {
OrderClose(OrderTicket(),OrderLots(),Bid,0);
}
}
}
closePosition = -1;
}
string GetCommentForOrder() { return(Name_Expert); }
double GetSizeLot() { return(Lots); }
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
---