Dislikedhi i have been trading manually for 1 year and it has earn me profits. can someone turn my strategy to a expert advisor? Inbox me.Ignored
Attached Image
Vucking good EA coder... https://t.ly/AZjRM
1
I will code your pivot EAs for no charge 28 replies
I will code your scalping EAs for no charge 163 replies
Oanda MT4 - Indicators and EAs not showing 2 replies
EAs and indicators relating to moutaki... 22 replies
InterbankFX has loaded its MT4 platform with custom EAs, indicators and scripts 1 reply
Dislikedhi i have been trading manually for 1 year and it has earn me profits. can someone turn my strategy to a expert advisor? Inbox me.Ignored
Dislikedhi i have been trading manually for 1 year and it has earn me profits. can someone turn my strategy to a expert advisor? Inbox me.Ignored
DislikedHi Guys, Looking for an EA which will be used in the DAX. Pretty simple: Open a position at a specific time with a given SL and TP. And also an Option when the Trade should be closed. Could you, please, help me with this?Ignored
#property copyright ""
#property strict
#define RUNS 20
#define SLEEP 1000
enum ENUM_TIMEFRAMES_MY
{
//None = -1,
Current = 0,
M1 = 1,
M5 = 5,
M15 = 15,
M30 = 30,
H1 = 60,
H4 = 240,
D1 = 1440,
W1 = 10080,
MN1 = 43200
};
//--- input parameters
extern ENUM_TIMEFRAMES_MY TF=0; //Time Frame
extern double PartialTP=20.0; //Take Profit Level
extern double BreakEvenAdd=5.0; //Pips Above Break Even
extern double TrailingStop=0.0; //Trailing Stop
extern double LotPartClose=0.03; //Lots to Close
extern ENUM_TIMEFRAMES_MY TimeFrameFractal=0; //Time Frame Fractals
extern bool FractalTrail=false; //Fractals Trailing Stop
extern double PipGap=5.0; //Pip Gap
extern int Slippage=3;
/*extern*/ int MagicNumber=0; //manua orders only
bool InitRun;
double mlt=1;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
mlt=1;
if(Digits==5 || Digits==3 || Digits==1) //5-digit broker
{
mlt *= 10;
PartialTP *= 10;
TrailingStop *= 10;
BreakEvenAdd *= 10;
PipGap *= 10;
}
InitRun=true;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//----
Comment("");
//----
return;
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(PartialTP>0.0)
{
BreakEven(MagicNumber,PartialTP,BreakEvenAdd);
if(LotPartClose>0.0) PartialClose(MagicNumber,PartialTP,LotPartClose/*,Comm*/);
if(TrailingStop>0.0) TrailingStopRegular(MagicNumber,TrailingStop,0.0,PartialTP);
if(FractalTrail) TrailingStopFractal(MagicNumber,TimeFrameFractal,PipGap,PartialTP);
}
InitRun=false;
//----
return(0);
}
//+------------------------------------------------------------------+
double ND(double val)
{
return(NormalizeDouble(val, Digits));
}
//+------------------------------------------------------------------+
string ErrorToString(int Error)
{
switch(Error)
{
case 1: return("No error returned, but the result is unknown.");
case 2: return("Common error.");
case 3: return("Invalid trade parameters.");
case 4: return("Trade server is busy.");
case 5: return("Old version of the client terminal.");
case 6: return("No connection with trade server.");
case 7: return("Not enough rights.");
case 8: return("Too frequent requests.");
case 9: return("Malfunctional trade operation.");
case 64: return("Account disabled.");
case 128: return("Trade timeout.");
case 129: return("Invalid price.");
case 130: return("Invalid stops.");
case 131: return("Invalid trade volume.");
case 132: return("Market is closed.");
case 133: return("Trade is disabled.");
case 134: return("Not enough money.");
case 135: return("Price changed.");
case 136: return("Off quotes.");
case 137: return("Broker is busy.");
case 138: return("Requote.");
case 139: return("Order is locked.");
case 140: return("Long positions only allowed.");
case 141: return("Too many requests.");
case 145: return("Modification denied because order too close to market.");
case 146: return("Trade context is busy.");
case 147: return("Expirations are denied by broker.");
case 148: return("The amount of open and pending orders has reached the limit set by the broker.");
case 149: return("An attempt to open a position opposite to the existing one when hedging is disabled.");
case 150: return("An attempt to close a position contravening the FIFO rule.");
default: return(StringConcatenate("Error #",Error));
}
}
//+------------------------------------------------------------------+
void BreakEven(int MagNum, double BE_Level, double BE_add=0.0)
{
if(BE_Level == 0) return;
int error;
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
int Type=OrderType();
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagNum && Type<=OP_SELL)
{
double OrderSL=ND(OrderStopLoss());
double OpenPrice=ND(OrderOpenPrice());
double NewSL=0;
if(Type==OP_BUY)
{
if(ND((Bid-OpenPrice)/Point)>=BE_Level && (OpenPrice>OrderSL || OrderSL==0))
{
NewSL=ND(OpenPrice+BE_add*Point);
if(NewSL>OrderSL || OrderSL==0)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),ND(NewSL),OrderTakeProfit(),0,Yellow))
{error=GetLastError(); Print(Symbol()," Break Even error: ",ErrorToString(error));}
continue;
}
}
if(Type==OP_SELL)
{
if(ND((OpenPrice-Ask)/Point)>=BE_Level && (OpenPrice<OrderSL || OrderSL==0))
{
NewSL=ND(OpenPrice-BE_add*Point);
if(NewSL<OrderSL || OrderSL==0)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),ND(NewSL),OrderTakeProfit(),0,Yellow))
{error=GetLastError(); Print(Symbol()," Break Even error: ",ErrorToString(error));}
continue;
}
}
}
}
}
//+------------------------------------------------------------------+
void PartialClose(int MgcNmb, double _TP, double _Lot/*, string _Comm*/)
{
int total=OrdersTotal();
for (int i = total-1; i >= 0; i--)
if(OrderSelect(i, SELECT_BY_POS))
{
int type=OrderType();
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MgcNmb && type<=OP_SELL && StringFind(OrderComment(),"#")<0)
{
if(ND((type==OP_BUY?1:-1)*(OrderClosePrice()-OrderOpenPrice()))>=ND(_TP*Point))
{
if (!OrderClose(OrderTicket(), _Lot, OrderClosePrice(), Slippage, clrWhite))
{int error=GetLastError(); Print(Symbol()," Exit Trade error: ",ErrorToString(error));}
}
}
}
return;
}
//+------------------------------------------------------------------+
int TrailingStopRegular(int MagNum, double _TrailingStopPip, double _TrailingStopStep, double _TrailingStopTrigger)
{
if(_TrailingStopPip == 0) return (0);
int total=OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
int Type=OrderType();
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagNum && Type<=OP_SELL)
{
double CurStopLoss=OrderStopLoss();
double OpenPrice=OrderOpenPrice();
double NewStoploss = 0.0;
if(Type==OP_BUY) //long
{
NewStoploss = Bid - _TrailingStopPip*Point;
if( (CurStopLoss >= NewStoploss && CurStopLoss != 0.0) || Bid-OpenPrice < _TrailingStopTrigger*Point ) NewStoploss = 0.0;
}
if(Type==OP_SELL) //short
{
NewStoploss = Ask + _TrailingStopPip*Point;
if( (CurStopLoss <= NewStoploss && CurStopLoss != 0.0) || OpenPrice-Ask < _TrailingStopTrigger*Point ) NewStoploss = 0.0;
}
if( NewStoploss != 0.0 )
{
if( MathAbs( CurStopLoss - NewStoploss ) <= Point*_TrailingStopStep ) continue;
else NewStoploss = NormalizeDouble( NewStoploss, Digits);
if(!OrderModify(OrderTicket(),OrderOpenPrice(), NewStoploss, OrderTakeProfit(),0/*,Yellow*/))
{int error=GetLastError(); Print(Symbol()," Modify Order error: ",ErrorToString(error)); continue;}
}
}
}
return (0);
}
//+------------------------------------------------------------------+
int TrailingStopFractal(int MagNum, int _TF, double _TrailingStopPip, double _TrailingStopTrigger)
{
if(_TrailingStopPip == 0) return (0);
int total=OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
int Type=OrderType();
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagNum && Type<=OP_SELL)
{
double CurStopLoss=OrderStopLoss();
double OpenPrice=OrderOpenPrice();
double NewStoploss = 0.0;
if(Type==OP_BUY) //long
{
NewStoploss = ND(FractalStopLoss(_TF,OP_BUY) - _TrailingStopPip*Point);//Bid - _TrailingStopPip*Point;
if( (CurStopLoss >= NewStoploss && CurStopLoss != 0.0) || Bid-OpenPrice < _TrailingStopTrigger*Point ) NewStoploss = 0.0;
}
if(Type==OP_SELL) //short
{
NewStoploss = ND(FractalStopLoss(_TF,OP_SELL) + _TrailingStopPip*Point);//Ask + _TrailingStopPip*Point;
if( (CurStopLoss <= NewStoploss && CurStopLoss != 0.0) || OpenPrice-Ask < _TrailingStopTrigger*Point ) NewStoploss = 0.0;
}
if( NewStoploss != 0.0 )
{
if(!OrderModify(OrderTicket(),OrderOpenPrice(), NewStoploss, OrderTakeProfit(),0,clrRed))
{int error=GetLastError(); Print(Symbol()," Modify Order error: ",ErrorToString(error)); continue;}
}
}
}
return (0);
}
//+------------------------------------------------------------------+
double FractalStopLoss(int _tf, int _type)
{
int mode=0;
switch(_type)
{
case OP_BUY: mode=MODE_LOWER; break;
case OP_SELL: mode=MODE_UPPER; break;
}
int i=3;
while(i<iBars(NULL,_tf))
{
double fr=iFractals(NULL,_tf,mode,i);
if(fr>0) return(fr);
i++;
}
return(0.0);
} Disliked{quote} This indicator repaint badly. let the indicator run on the chart for a time and then take a screen shot and then refresh the chart and take another screen shot. you will see the differentIgnored
DislikedHey guys, could you help me modified the indicator. mark a label that show the actual value of the upper and lower line when every candle closed. thanks in advance. {file}Ignored
Disliked{quote} But look at your profile....shouted something there... {image}Ignored
Disliked{quote} Its good to test out people system tho to see if its better than ur own system. Can't see or test my system statistic in the strategy tester, since i can't code a expert advisorIgnored
DislikedHey Guys, i want to learn and improve my MQL4 skills. I think the best way to do this is to practice. Unfortunately sometimes I don`t have any nice idea which i can implement in a Expert Advisor / Indicator. So if any of you is interested, please post in this forum your ideas and i will try to implement it into mql4. AndiIgnored
DislikedHi coders, I am looking for a simple indicator which shows the 2 consecutive marubozu candles without tails If you could do that I would be very grateful . . . Thanks in advance.Ignored
Disliked{quote} Alert timestamp is local time not server time. Server time can = local time or = ahead or behind.{image}↓ Consecutive marubozu - few and far between & less so on higher time frames. (to view expanded click image x2 and scroll left-right){image} ↓ To check accuracy of marubozu candles expand chart - zoom in{image}Note: Indicator will set Chart on Foreground = false in order to show marubozu candle highlight (this will override chart properties [see: right click - Properties - Common tab]). Chart on Foreground can be set = true...Ignored
Disliked{quote} Hi Phylo, THANK YOU VERY MUCH!!! Marubozu Alerts v2b.ex4 is exactly what I need. Perfect job! Symbol changer looks very helpful. Is it possible to get it too? Thanks again!Ignored
source: https://en.wikipedia.org/wiki/Marubozu
Note: Indicator will set Chart on Foreground = false in order to show marubozu candle highlight (this will override chart properties [see: right click - Properties - Common tab]). Chart on Foreground can be set = true from the Inputs tab if required.
Marubozu Alerts v4a: default - marubozu // second selection - consecutive marubozu only
Marubozu Alerts v4b: default - consecutive marubozu only // second selection - marubozu
Alert timestamp is local time not server time. Server time can = local time or = ahead or behind.
Alert images zoomed in max to check correct direction of Tweezers Top & Bottom highlight.
Tweezers Top