Forex Factory
  • Login

  • Username: Password:
  • 1:30pm

  • Search
  • Home

  • Forums

  • Trades

  • Calendar

  • News

  • Market

  • Brokers

Options

Search
Search
Search

Subscribe to Thread

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

Need help programming some indicators/EAs 64 replies

Do You Buy EAs or Indicators from ebay? 59 replies

Dreamliners’ MPAS EAs, Indicators, etc 297 replies

Future EAs Code Language? 6 replies

EAs and indicators relating to moutaki... 17 replies

  • Platform Tech
  • /
  • Reply to Thread
  • 1,077

I will code your EAs and Indicators for no charge

  • Last Post
  • First Unread
  •  
  • 1 4950Page 515253 115
  •  
  • Post# 1,001
  • Quote
  • Sep 1, 2012 7:47am
  • daujones
    Joined Sep 2012 | 5 Posts | Status: Member
I need help with building 1 indicator for Metatrader 4.

It should compare 2 charts, one old and one currently being developed (today intraday) and indicate sertain similarities as they are being made according to 3 types of chart behaviour. This indicator should NOT be in chart. I have included an overall explanation of this idea, see attached files.

Actually, my idea would like its own thread but as long i dont have one you guys can simply ask me questions here.
Attached Images (click to enlarge)
Click to Enlarge

Name: gold_explanation.JPG
Size: 57 KB Click to Enlarge

Name: gold2.JPG
Size: 68 KB
Attached File
File Type: docx DAU_indicators.docx   71 KB | 44 downloads
  • Post# 1,002
  • Quote
  • Sep 2, 2012 4:43pm
  • soulfly
    Joined Dec 2010 | 22 Posts | Status: Member
Quoting soulfly
Hi there.
I am a newstrader.
Currently i place a buy and a sell stop just before important news hit the marked.
problem is that is is cumbersome to do this manually.

I would like a option where I can select the cross i want to trade.
The input should be.

Input Example
Volume in lots 50
Cross EURUSD
open price deviation pips: 10
Stopp loss in pisp 10
take profit in pips 10
Place orders button click to place trades

in...
I will be willing to pay if someone can create this.

Thanks
  • Post# 1,003
  • Quote
  • Sep 2, 2012 10:26pm
  • Newton51
    Joined Jan 2012 | 23 Posts | Status: Member
Quoting soulfly
I will be willing to pay if someone can create this.

Thanks
EA's that do more or less what you seek already exist. If you do a search for "NewsTrader" / "TimeEntry" or "TimeBased EA" as search strings, I think you will find something suitable.
  • Post# 1,004
  • Quote
  • Sep 3, 2012 7:21am
  • viat
    Joined Sep 2006 | 55 Posts | Status: Member
Hi Guys! Is it possible to make indicator that able to expand life of the object (rectangle) up to current price. Another words if I've draw rectangle anywhere in history on charts it will continue to expand into the future with price movement.
Thank you in advance!!!
  • Post# 1,005
  • Quote
  • Sep 3, 2012 8:57am
  • gordong
    Joined Dec 2011 | 12 Posts | Status: Member
Hi guys,

Im looking for an EA that would alert me to whenever a new hikkake/fakey pattern develops on a chart..I am also looking for the same EA for Inside Bars..

If you could point me to the right direction or share it that would be much appreciated.

thanx in advance,
g
  • Post# 1,006
  • Quote
  • Sep 3, 2012 9:55am
  • hespee
    Joined Sep 2012 | 2 Posts | Status: Junior Member
Quoting Metatrader
Hey 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.

Andi


sqdynamicbreakoutbox is system that gives buy and sell signal daily base on 15mins time frame. so i discover using 40pips hedging strategy it hardly get to 4th level before it delivers 40pips profit. this is how i use the hedging strategy 1st buy lot 0.01, TP 40, SL 39 so immediately i place d second order which is sell lot 0.02 TP 40 SL 39. i do that up till 4th level and always delievers 40pips or more. so can u pls help to make it EA
  • Post# 1,007
  • Quote
  • Sep 3, 2012 10:17am
  • hespee
    Joined Sep 2012 | 2 Posts | Status: Junior Member
writing you again....so i want you to help me create an hedging system of four levels that is lot 0.01, 0.02, 0.04, 0.08. TP 40, SL 39. and combine it with the signal giving by the sqdynamicbreakout system. i want the trading time to be 7GMT. and also to have a trailing stop once 40pips is secure. so the hedging is going to be use around the signal given by sqdynamicbreakout system... i hope u can understand what am trying to say......hedging stragey works effectively well by the place order base on the signal generated by sqbreakout strategy starting from 7GMT.
Attached Images (click to enlarge)
Click to Enlarge

Name: Capture 9.PNG
Size: 64 KB Click to Enlarge

Name: hespee trading wizard uncheck.PNG
Size: 57 KB
  • Post# 1,008
  • Quote
  • Sep 3, 2012 2:43pm
  • Vikingbarde
    Joined Apr 2012 | 111 Posts | Status: viking
Quoting lector
Hi biker883

It happens that I am working on Demand Index Indicator and my implementation is similar to what you described. The difference is, in my version, K = 3 * average(H, L, C, C) / VA.

The attached Demand Index indicator comes with default MA period as 10 and is adjustable as well. Other than that, BP and SP are available in the Data Window.

Hope you will find it useful. I would be happy to modify the indicator in case you have any comments or suggestions.

Happy Charting~

Lector

I am wondering if it would be possible to amend one line of the EA, I am not sure how to correct it? and test it if wish ? Thank you
I have included the file in word doc, highlighted the problem line, copy below
request.type_filling=ORDER_FILLING_ AON;

Thank you VikingBarde
my email address is worknsave@yahoo.com
Attached File
File Type: doc Sent to Forex Factory.doc   38 KB | 82 downloads
  • Post# 1,009
  • Quote
  • Sep 3, 2012 7:42pm
  • FranksBiz
    Joined May 2012 | 65 Posts | Status: Member
Does anyone have any help material for the EA builder like Glossary of terms or a good manual.

Thanks
  • Post# 1,010
  • Quote
  • Sep 5, 2012 7:02am
  • corliz
    Joined May 2012 | 11 Posts | Status: Member
Hi

Do you still code EA's.

I have got a strategy that is massively successful and need someone to code it for me privately.

What will you ask me?

corlizfx@gmail.com

Regards
  • Post# 1,011
  • Quote
  • Sep 5, 2012 3:18pm
  • lector
    Joined Aug 2012 | 3 Posts | Status: Member
Quoting Newton51
This DemandIndexIndicator is quite useful I can see. It seems to need something to refresh the data as it ceases to update the data and wonnder if you can fix this and re-post?
Hi Newton51

Thanks for your feedback. Attached is the latest Demand Index Indicator (version 1.0.3) with the refresh problem fixed.

Lector
Attached File
File Type: ex4 DemandIndexIndicator(lector)_v1.0.3.ex4   9 KB | 115 downloads
  • Post# 1,012
  • Quote
  • Sep 6, 2012 2:19pm
  • Forexaccount
    Joined Oct 2009 | 172 Posts | Status: Member
This indicator changes as soon as I change time frames. I would like it to stay in one specific time frame even if I change the Time Frame. Let say I want it on H1 but when I go to M30 it will redraw again. Also, I would like price and date labels at the top and bottom of the blue bands, small text if possible. You can write me at:

forexaccount2009 at gmail dot com

Thanks
Attached File
File Type: mq4 HG.mq4   8 KB | 60 downloads
  • Post# 1,013
  • Quote
  • Sep 7, 2012 1:43am
  • ollyfx
    Joined Sep 2012 | 9 Posts | Status: Member
hello every body the back test of this EA is so good that i really want to try it put on my demo first. but each time it tries to trade it says invalid price sendorder function() error 4107 please help me
below is the cose
//+------------------------------------ ------------------------------+
//| EM_VOL.mq4 |
//| Copyright © 2011, AutomatiKForeX |
//| http://www.automatikforex.blogspot.com |
//+------------------------------------ ------------------------------+
//----
extern int MMType=1;
extern bool UseClose=false;
extern bool UseAdd=true;
extern double LotExponent=1.2;
extern double slip=3;
extern double Lots=0.2;
extern double LotsDigits=2;
extern double TakeProfit=100;
extern double Stoploss=500;
extern double TrailStart=10;
extern double TrailStop=10;
extern double PipStep=30;
extern int MaxTrades=30;
extern bool UseEquityStop=false;
extern double TotalEquityRisk=20;
extern bool UseTrailingStop=true;
extern bool UseTimeOut=false;
extern double MaxTradeOpenHours=48;
extern double MaximumRisk=0.002;
//----
int MagicNumber=675;
double PriceTarget, StartEquity, BuyTarget, SellTarget;
double AveragePrice, SellPoint, BuyPoint;
double LastBuyPrice, LastSellPrice, ClosePrice, Spread;
int flag;
string EAName="EM-VOL 1/1vs C";
datetime timeprev=0, expiration;
int NumOfTrades=0;
double iLots;
int cnt=0, total;
double Stopper=0;
bool TradeNow=true, LongTrade=true, ShortTrade=true;
int ticket;
bool NewOrdersPlaced=true;
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int init()
{
Spread=MarketInfo(Symbol(), MODE_SPREAD)*Point;
return(0);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int start()
{
if (UseTrailingStop)
{
TrailingAlls(TrailStart, TrailStop, AveragePrice);
}
if (UseTimeOut){
if(CurTime()>=expiration)
{
CloseThisSymbolAll();
Print("Closed All due to TimeOut");
}
}
if(timeprev==Time[0])
{
return(0);
}
timeprev=Time[0];
//----
double CurrentPairProfit=CalculateProfit() ;
if(UseEquityStop){
if(CurrentPairProfit<0 && MathAbs(CurrentPairProfit)>(TotalEq uityRisk/100)*AccountEquityHigh())
{
CloseThisSymbolAll();
Print("Closed All due to Stop Out");
NewOrdersPlaced=false;
}
}
total=CountTrades();
//----
if (total==0)
{
flag=0;
}
double LastBuyLots;
double LastSellLots;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--){
OrderSelect(cnt,SELECT_BY_POS,MODE_ TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)continue;
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_BUY)
{
LongTrade=true;
ShortTrade=false;
LastBuyLots=OrderLots();
break;
}
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_SELL)
{
LongTrade=false;
ShortTrade=true;
LastSellLots=OrderLots();
break;
}
}

double PivPnt=(iHigh(Symbol(),0,1)+iLow(Sy mbol(),0,1)+iClose(Symbol(),0,1)+iO pen(Symbol(),0,1))/4;

double Res1=iHigh(Symbol(),0,1)+iATR(Symbo l(),0,14,1);
double Sup1=iLow(Symbol(),0,1)-iATR(Symbol(),0,14,1);
double C1=iClose(Symbol(),0,1);
double O1=iOpen(Symbol(),0,1);
double L1=iLow(Symbol(),0,1);
double H1=iHigh(Symbol(),0,1);
double BandUP=iBands(Symbol(),0,20,2,0,PRI CE_CLOSE,1,0);
double BandDown=iBands(Symbol(),0,20,-2,0,PRICE_CLOSE,1,0);
double L2=iLow(Symbol(),0,2);
double H2=iHigh(Symbol(),0,2);
double C2=iClose(Symbol(),0,2);
double ADX=iADX(NULL,0,14,PRICE_CLOSE,MODE _MAIN,1);
if(total>0 && total<=MaxTrades)
{
RefreshRates();
LastBuyPrice=FindLastBuyPrice();
LastSellPrice=FindLastSellPrice();
if(LongTrade && (LastBuyPrice - Ask)>=(PipStep*Point))
{
TradeNow=true;
}
if(ShortTrade && (Bid - LastSellPrice)>=(PipStep*Point))
{
TradeNow=true;
}
}
if (total < 1)
{
ShortTrade=false;
LongTrade=false;
TradeNow=true;
StartEquity=AccountEquity();
}
if (TradeNow)
{
LastBuyPrice=FindLastBuyPrice();
LastSellPrice=FindLastSellPrice();
if(ShortTrade)
{
if(UseClose)
{
fOrderCloseMarket(false,true);
iLots=NormalizeDouble(LotExponent*L astSellLots,LotsDigits);
}
else
{
iLots=fGetLots(OP_SELL);
}
if(UseAdd)
{
NumOfTrades=total;
if(iLots>0)
{//#
RefreshRates();
ticket=OpenPendingOrder(OP_SELL,iLo ts,Bid,slip,Ask,0,0,EAName+"-"+NumOfTrades,MagicNumber,0,Orange) ;
if(ticket<0){Print("Error: ",GetLastError()); return(0);}
LastSellPrice=FindLastSellPrice();
TradeNow=false;
NewOrdersPlaced=true;
}//#
}
}
else if (LongTrade)
{
if(UseClose)
{
fOrderCloseMarket(true,false);
iLots=NormalizeDouble(LotExponent*L astBuyLots,LotsDigits);
}
else
{
iLots=fGetLots(OP_BUY);
}
if(UseAdd)
{
NumOfTrades=total;
if(iLots>0)
{//#
ticket=OpenPendingOrder(OP_BUY,iLot s,Ask,slip,Bid,0,0,EAName+"-"+NumOfTrades,MagicNumber,0,Blu e);
if(ticket<0)
{Print("Error: ",GetLastError()); return(0);}
LastBuyPrice=FindLastBuyPrice();
TradeNow=false;
NewOrdersPlaced=true;
}//#
}
}
}
if (TradeNow && total<1)
{

SellPoint=Sup1-(1*Point);
BuyPoint=Res1+(1*Point);
if(!ShortTrade)
{
NumOfTrades=total;
if(ADX<30 )
{
double lots=Lots;
lots=NormalizeDouble(AccountFreeMar gin()*MaximumRisk/1000.0,LotsDigits);
if(lots>0)
{//#
ticket=OrderSend(Symbol(),OP_SELLST OP,lots,SellPoint,slip,0,0,EAName+"-"+NumOfTrades,MagicNumber,0,Red );
if(ticket<0){Print(iLots,"Error: ",GetLastError()); return(0);
}
LastBuyPrice=FindLastBuyPrice();
NewOrdersPlaced=true;
}//#
}
if(!LongTrade)
NumOfTrades=total;
if(ADX<30)
{

lots=NormalizeDouble(AccountFreeMar gin()*MaximumRisk/1000.0,LotsDigits);
if(lots>0)

{//#
ticket=OrderSend(Symbol(),OP_BUYSTO P,lots,BuyPoint,slip,0,0,EAName+"-"+NumOfTrades,MagicNumber,0,Lim e);
if(ticket<0){Print(iLots,"Error: ",GetLastError()); return(0);}
LastSellPrice=FindLastSellPrice();
NewOrdersPlaced=true;
}//#
}
}
if(ticket>0) expiration=CurTime()+MaxTradeOpenHo urs*60*60;
TradeNow=false;
}
//----------------------- CALCULATE AVERAGE OPENING PRICE
total=CountTrades();
AveragePrice=0;
double Count=0;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
AveragePrice=AveragePrice+OrderOpen Price()*OrderLots();
Count=Count + OrderLots();
}
}
if(total > 0)
AveragePrice=NormalizeDouble(Averag ePrice/Count, Digits);
//----------------------- RECALCULATE STOPLOSS & PROFIT TARGET BASED ON AVERAGE OPENING PRICE
if(NewOrdersPlaced)
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_BUY) // Calculate profit/stop target for long
{
PriceTarget=AveragePrice+(TakeProfi t*Point);
BuyTarget=PriceTarget;
Stopper=AveragePrice-(Stoploss*Point);
// Stopper=0;
flag=1;
}
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_SELL) // Calculate profit/stop target for short
{
PriceTarget=AveragePrice-(TakeProfit*Point);
SellTarget=PriceTarget;
Stopper=AveragePrice+(Stoploss*Poin t);
// Stopper=0;
flag=1;
}
}
//----------------------- IF NEEDED CHANGE ALL OPEN ORDERS TO NEWLY CALCULATED PROFIT TARGET
if(NewOrdersPlaced)
if(flag==1)// check if average has really changed
{
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
// PriceTarget=total;
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
// OrderModify(OrderTicket(),0,Stopper ,PriceTarget,0,Yellow);// set all positions to averaged levels
OrderModify(OrderTicket(),AveragePr ice,OrderStopLoss(),PriceTarget,0,Y ellow);// set all positions to averaged levels
NewOrdersPlaced=false;
}
}
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double ND(double v){return(NormalizeDouble(v,Digits) );}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int fOrderCloseMarket(bool aCloseBuy=true,bool aCloseSell=true)
{
int tErr=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE _TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY && aCloseBuy)
{
RefreshRates();
if(!IsTradeContextBusy())
{
if(!OrderClose(OrderTicket(),OrderL ots(),ND(Bid),5,CLR_NONE))
{
Print("Error close BUY "+OrderTicket());//+" "+fMyErDesc(GetLastError()));
tErr=-1;
}
}
else
{
static int lt1=0;
if(lt1!=iTime(NULL,0,0))
{
lt1=iTime(NULL,0,0);
Print("Need close BUY "+OrderTicket()+". Trade Context Busy");
}
return(-2);
}
}
if(OrderType()==OP_SELL && aCloseSell)
{
RefreshRates();
if(!IsTradeContextBusy())
{
if(!OrderClose(OrderTicket(),OrderL ots(),ND(Ask),5,CLR_NONE))
{
Print("Error close SELL "+OrderTicket());//+" "+fMyErDesc(GetLastError()));
tErr=-1;
}
}
else
{
static int lt2=0;
if(lt2!=iTime(NULL,0,0))
{
lt2=iTime(NULL,0,0);
Print("Need close SELL "+OrderTicket()+". Trade Context Busy");
}
return(-2);
}
}
}
}
}
return(tErr);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double fGetLots(int aTradeType)
{
double tLots;
switch(MMType)
{
case 0:
tLots=Lots;
break;
case 1:
tLots=NormalizeDouble(Lots*MathPow( LotExponent,NumOfTrades),LotsDigits );
break;
case 2:
int LastClosedTime=0;
tLots=Lots;
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE _HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
{
if(LastClosedTime<OrderCloseTime())
{
LastClosedTime=OrderCloseTime();
if(OrderProfit()<0)
{
tLots=NormalizeDouble(OrderLots()*L otExponent,LotsDigits);
}
else
{
tLots=Lots;
}
}
}
}
else
{
return(-3);
}
}
break;
}
if(AccountFreeMarginCheck(Symbol(), aTradeType,tLots)<=0)
{
return(-1);
}
if(GetLastError()==134)
{
return(-2);
}
return(tLots);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int CountTrades()
{
int count=0;
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MOD E_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()&&OrderMa gicNumber()==MagicNumber)
if(OrderType()==OP_SELL || OrderType()==OP_BUY)
count++;
}//for
return(count);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
void CloseThisSymbolAll()
{
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MOD E_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()== MagicNumber)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots( ),Bid,slip,Blue);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots( ),Ask,slip,Red);
}
Sleep(1000);
}
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
int OpenPendingOrder(int pType,double pLots,double pLevel,int sp, double pr, int sl, int tp,string pComment,int pMagic,datetime pExpiration,color pColor)
{
int ticket=0;
int err=0;
int c=0;
int NumberOfTries=100;
switch(pType)
{
case OP_BUYLIMIT:
for(c=0;c < NumberOfTries;c++)
{
ticket=OrderSend(Symbol(),OP_BUYLIM IT,pLots,pLevel,sp,StopLong(pr,sl), TakeLong(pLevel,tp),pComment,pMagic ,pExpiration,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(1000);
continue;
}
else //normal error
{
break;
}
}
}
break;
case OP_BUYSTOP:
for(c=0;c < NumberOfTries;c++)
{
ticket=OrderSend(Symbol(),OP_BUYSTO P,pLots,pLevel,sp,StopLong(pr,sl),T akeLong(pLevel,tp),pComment,pMagic, pExpiration,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
break;
case OP_BUY:
for(c=0;c < NumberOfTries;c++)
{
RefreshRates();
ticket=OrderSend(Symbol(),OP_BUY,pL ots,Ask,sp,StopLong(Bid,sl),TakeLon g(Ask,tp),pComment,pMagic,pExpirati on,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
break;
case OP_SELLLIMIT:
for(c=0;c < NumberOfTries;c++)
{
ticket=OrderSend(Symbol(),OP_SELLLI MIT,pLots,pLevel,sp,StopShort(pr,sl ),TakeShort(pLevel,tp),pComment,pMa gic,pExpiration,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
break;
case OP_SELLSTOP:
for(c=0;c < NumberOfTries;c++)
{
ticket=OrderSend(Symbol(),OP_SELLST OP,pLots,pLevel,sp,StopShort(pr,sl) ,TakeShort(pLevel,tp),pComment,pMag ic,pExpiration,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
break;
case OP_SELL:
for(c=0;c < NumberOfTries;c++)
{
ticket=OrderSend(Symbol(),OP_SELL,p Lots,Bid,sp,StopShort(Ask,sl),TakeS hort(Bid,tp),pComment,pMagic,pExpir ation,pColor);
err=GetLastError();
if(err==0)
{
break;
}
else
{
if(err==4 || err==137 ||err==146 || err==136) //Busy errors
{
Sleep(5000);
continue;
}
else //normal error
{
break;
}
}
}
break;
}

return(ticket);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double StopLong(double price,int stop)
{
if(stop==0)
return(0);
else
return(price-(stop*Point));
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double StopShort(double price,int stop)
{
if(stop==0)
return(0);
else
return(price+(stop*Point));
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double TakeLong(double price,int take)
{
if(take==0)
return(0);
else
return(price+(take*Point));
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double TakeShort(double price,int take)
{
if(take==0)
return(0);
else
return(price-(take*Point));
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double CalculateProfit()
{
double Profit=0;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
Profit=Profit+OrderProfit();
}
}
return(Profit);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
void TrailingAlls(int start,int stop, double AvgPrice)
{
int profit;
double stoptrade;
double stopcal;
if(stop==0)
return;
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
if(!OrderSelect(trade,SELECT_BY_POS ,MODE_TRADES))
continue;
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()||OrderMa gicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
profit=NormalizeDouble((Bid-AvgPrice)/Point,0);
if(profit<start)
continue;
stoptrade=OrderStopLoss();
stopcal=Bid-(stop*Point);
if(stoptrade==0||(stoptrade!=0&&sto pcal>stoptrade))
// OrderModify(OrderTicket(),OrderOpen Price(),stopcal,OrderTakeProfit(),0 ,Blue);
OrderModify(OrderTicket(),AvgPrice, stopcal,OrderTakeProfit(),0,Aqua);
}//Long
if(OrderType()==OP_SELL)
{
profit=NormalizeDouble((AvgPrice-Ask)/Point,0);
if(profit<start)
continue;
stoptrade=OrderStopLoss();
stopcal=Ask+(stop*Point);
if(stoptrade==0||(stoptrade!=0&&sto pcal<stoptrade))
// OrderModify(OrderTicket(),OrderOpen Price(),stopcal,OrderTakeProfit(),0 ,Red);
OrderModify(OrderTicket(),AvgPrice, stopcal,OrderTakeProfit(),0,Red);
}//Shrt
}
Sleep(1000);
}//for
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double AccountEquityHigh()
{
static double AccountEquityHighAmt,PrevEquity;
if(CountTrades()==0) AccountEquityHighAmt=AccountEquity( );
if(AccountEquityHighAmt < PrevEquity) AccountEquityHighAmt=PrevEquity;
else AccountEquityHighAmt=AccountEquity( );
PrevEquity=AccountEquity();
return(AccountEquityHighAmt);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double FindLastBuyPrice()
{
double oldorderopenprice=0, orderprice;
int cnt, oldticketnumber=0, ticketnumber;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderType()==OP_BUY)
{
ticketnumber=OrderTicket();
if(ticketnumber>oldticketnumber)
{
orderprice=OrderOpenPrice();
oldorderopenprice=orderprice;
oldticketnumber=ticketnumber;
}
}
}
return(orderprice);
}
//+------------------------------------ ------------------------------+
//| |
//+------------------------------------ ------------------------------+
double FindLastSellPrice()
{
double oldorderopenprice=0, orderprice;
int cnt, oldticketnumber=0, ticketnumber;
for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol()!=Symbol()||OrderMa gicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderType()==OP_SELL)
{
ticketnumber=OrderTicket();
if(ticketnumber>oldticketnumber)
{
orderprice=OrderOpenPrice();
oldorderopenprice=orderprice;
oldticketnumber=ticketnumber;
}
}
}
return(orderprice);
}
//+----------
  • Post# 1,014
  • Quote
  • Sep 7, 2012 4:27am
  • Forexpapa
    Joined Jul 2012 | 2 Posts | Status: Member
Hello to All,

Please make this EA for me . i searched this in forum but could not find may be if you have link pls provide or create for me this EA

Grid base EA.

1) Buy/Sell as per MA 14
Above 14 buy below 14 sell

2) also at the same time reverse buy or sell pending order should be placed of 3 times of initial lots. with 30 pips different

- means if EAs first order is buy then sell pending order should place vice-verse for sell.

3) means if first buy order was buy 0.01 at 1.2500 then 1 sell pending @1.2470 (30 pip below) with 0.03 lots and first order close. and place 1 buy pending @ 1.2500 of 0.09lots

every 30 pips apart buy/sell pending orders lot size increased by 3 times after every new order all old order must be close.



7) if profit of 50 $ close all and then sleep for 30 minutes.

and again start with point (1) [MA 14 technik ] and so on

pls help to make this EA
  • Post# 1,015
  • Quote
  • Sep 7, 2012 7:54am | Edited at 7:56am – add info
  • soulfly
    Joined Dec 2010 | 22 Posts | Status: Member
Quoting Newton51
EA's that do more or less what you seek already exist. If you do a search for "NewsTrader" / "TimeEntry" or "TimeBased EA" as search strings, I think you will find something suitable.
funniest thing.
found a EA that is doing what I need, but the the seller have not shippet yet and seems to be a scam site.
http://www.forex-expert-advisor.com/EA-News_full.htm

so still,
if anyone can code this that would be very nice

original request
http://www.forexfactory.com/showthre...166758&page=67
  • Post# 1,016
  • Quote
  • Sep 7, 2012 10:09am
  • himnoor ● Online
    Joined May 2010 | 115 Posts | Status: Member
Hi,

is there any one can modify attached indi. or make new one like this as explained below please

this is basket indicator see attached one
need to do two basket in one

It has "+" for buy and "-" sell i.e

1*EURUSD-.5*CADJPY+.13*EURCAD...... so on as many we want.
this is one basket that create one graph line like profit

1) looking to have another same basket in this same indicator that can create another line

2) pairs display on right "red" for 1st basket "green" for 2nd basket

3)should have a neutral period Like it will start from Zero middle line after input time or backbars like option parameter "look back bars 1 or2 or3 or4 .... and D1 and 0 for Never

4) it should works also with jpy pairs and xauusd xagusd xaujpy all

5) Difference between two basket lines display with alarm and email on

sorry for poor english let me know if you donot get it
thanks
Attached File
File Type: mq4 Basket Profit sq.mq4   15 KB | 48 downloads
  • Post# 1,017
  • Quote
  • Sep 7, 2012 3:21pm
  • ollyfx
    Joined Sep 2012 | 9 Posts | Status: Member
hello that code i posted above is one of the most profitable EA i have ever seen. it works well o demo but it does not trade. each time it execute an order invalid price is returned back,Error 4107. below is the strategic test.i does trade once in a while but most times send error massage bacsk. i don't know what to do
Attached Images (click to enlarge)
Click to Enlarge

Name: StrategyTester3.gif
Size: 9 KB Click to Enlarge

Name: StrategyTester 2.gif
Size: 9 KB
  • Post# 1,018
  • Quote
  • Sep 7, 2012 5:28pm
  • Newton51
    Joined Jan 2012 | 23 Posts | Status: Member
Quoting ollyfx
hello that code i posted above is one of the most profitable EA i have ever seen. it works well o demo but it does not trade. each time it execute an order invalid price is returned back,Error 4107. below is the strategic test.i does trade once in a while but most times send error massage bacsk. i don't know what to do
I spotted many spaces in the code posted above. The spaces made the code a nonsense e.g. OP_SELLST OP instead of OP_SELLSTOP, ... mag ic.. (magic) , L ime (Lime) etc. I removed the spaces and it compiles properly and works in Strategy Tester. The market is closed so I don't know if it works properly in forward test.

ollyfx, it's best to attach the file instead of pasting the code into the body of the thread.
Attached File
File Type: mq4 EM_Vol_FF.mq4   19 KB | 86 downloads
  • Post# 1,019
  • Quote
  • Sep 8, 2012 2:45am
  • ollyfx
    Joined Sep 2012 | 9 Posts | Status: Member
hell i will like to share this profitable EA with you. works well on test demo and it gives good result i think this is one of it kind but i placed it on my demo account each time it tries to open trade it say order send funcion invalid price at o.2602 when the actual price is at 0.2682 EUR/USD Error 4107.please i need your help to fix this thanks.
Attached Image (click to enlarge)
Click to Enlarge

Name: StrategyTester 2.gif
Size: 9 KB
Attached File
File Type: mq4 EM_VOL.mq4   29 KB | 66 downloads
  • Post# 1,020
  • Quote
  • Sep 8, 2012 3:36pm | Edited Sep 9, 2012 10:35am
  • lector
    Joined Aug 2012 | 3 Posts | Status: Member
Thanks for the feedback received on FF! Here is the latest Demand Index Indicator.

In this version, Demand Index of zero bar (current yet unformed bar) is available by default in order to reflect latest changes in price and volume on chart.

For shorter time frame analysis, or in case you would like to disable zero bar demand index, turn off SHOW_CURRENT variable on "Inputs" tab.

Hope you guys find it useful!

Lector
Attached File
File Type: ex4 DemandIndexIndicator(lector)_v1.1.0.ex4   9 KB | 115 downloads
Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email This Thread Email This Thread
Search this Thread:

Advanced Search

  • Platform Tech
  • /
  • I will code your EAs and Indicators for no charge
  • Reply to Thread
    • 1 4950Page 515253 115
2 traders viewing now
  • More

©2013 Forex Factory, Inc. / Terms of Use / Privacy Policy

Forex Factory® is a registered trademark.

Connect

  • Facebook
  • Twitter
  • RSS

Company

  • About FF
  • FF Blog
  • Careers at FF
  • Advertising
  • Contact FF

Products

  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer

Website

  • Homepage
  • Search
  • User Guide
  • Member List
  • Online Now
  • Report a Bug