| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack (1) | Thread Tools | Display Modes |
|
|||
|
Quote:
Bool Condition 1 = True: Indicator A color = Yellow //UP Direction - Buffer 2 Bool Condition 1 = True: Indicator B color = Clr_NONE - Buffer 3 Bool Condition 2 = False: Indicator A color = Clr_NONE - Buffer 2 Bool Condition 2 = False: Indicator B color= Magenta //Down Direction - Buffer 3 Lux, How do I resolve this then?? Anxiously awaiting your reply! And Thanks for responding ![]() Dave Last edited by Dave137; 09-10-2008 at 04:57 AM. |
|
|||
|
Quote:
FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM NEW: video presentation of the Probability Meter ... 24hrs action on the website |
|
|||
|
Need Help for this Expert Advisor "FirefilyEA
Please can someone assist me review this EA i just design but still having error and takes too long to start like 5 miniutes please i need your help if you can edit you can send the code to me e-mail: hamabdul11@yahoo.com thanks
code: //+------------------------------------------------------------------+ //| FireFly EA.mq4 | //| Copyright © 2008, SuperHamza | //| hamabdul11@yahoo.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, SuperHamza" #property link "hamabdul11@yahoo.com" extern int MagicNumber = 12345, Slippage = 2, TakeProfit = 40, StopLoss = 20, TrailingStop = 20, TSMinProfit = 0; extern double Lots = 0.1; extern bool WaitForBarClose = true, OneEntryPerBar = true; datetime entrytime; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- int ticket = 0; int shift = 0; if(WaitForBarClose) { shift = 1; } double Stoch = iStochastic(Symbol(),0,3,1,1,MODE_SMA,1,MODE_MAIN, shift); double Envy = StochEnvyVal(shift); double StochLast = iStochastic(Symbol(),0,3,1,1,MODE_SMA,1,MODE_MAIN, shift+1); double EnvyLast = StochEnvyVal(shift+1); double RSI = iRSI(Symbol(),0,3,PRICE_CLOSE, shift); Comment("Stoch: "+Stoch+" |RSI: "+RSI+" |Envy: "+Envy); //----------------------- TRAILING STOP if(TrailingStop>0 && subTotalTrade()>0) { int total = OrdersTotal(); for(int cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { subTrailingStop(OrderType()); } } } if(!OneEntryPerBar) { entrytime = 0; } if(subTotalTrade()<1) { //OP_BUY if((Stoch>Envy&&StochLast<EnvyLast&&RSI>50)&&entry time!=iTime(Symbol(),0,0)) { ticket = subOpenOrder(OP_BUY, Lots, StopLoss, TakeProfit,MagicNumber); if(ticket>0)entrytime=iTime(Symbol(),0,0); } //OP_SELL if((Stoch<Envy&&StochLast>EnvyLast&&RSI<50)&&entry time!=iTime(Symbol(),0,0)) { ticket = subOpenOrder(OP_SELL, Lots, StopLoss, TakeProfit,MagicNumber); if(ticket>0)entrytime=iTime(Symbol(),0,0); } } if((subTotalTrade()>0)&&entrytime!=iTime(Symbol(), 0,0)) { //CLOSE_SELL if(Stoch>Envy) { subCloseOrder(OP_SELL); } //CLOSE_BUY if(Stoch<Envy) { subCloseOrder(OP_BUY); } } //---- return(0); } //+------------------------------------------------------------------+ double StochEnvyVal(int shift) { double stoch[]; ArrayResize(stoch, Bars); ArraySetAsSeries(stoch,true); for(int i=Bars; i>=0; i--) { stoch[i]=iStochastic(Symbol(),0,3,1,1,MODE_SMA,1,MODE_MAIN ,i+shift); } double envy = iEnvelopesOnArray(stoch, 0, 41, MODE_LWMA, 0, 70, MODE_LOWER, 0) ; return(envy); } int subOpenOrder(int type, double Lotz, int stoploss, int takeprofit,int MagicNumber) { int NumberOfTries = 15; string TicketComment = "FireFly EA"; int ticket = 0, err = 0, c = 0; double aStopLoss = 0, aTakeProfit = 0, bStopLoss = 0, bTakeProfit = 0; if(stoploss!=0) { aStopLoss = NormalizeDouble(Ask-stoploss*Point,4); bStopLoss = NormalizeDouble(Bid+stoploss*Point,4); } if(takeprofit!=0) { aTakeProfit = NormalizeDouble(Ask+takeprofit*Point,4); bTakeProfit = NormalizeDouble(Bid-takeprofit*Point,4); } if(type==OP_BUY) { for(c=0;c<NumberOfTries;c++) { ticket=OrderSend(Symbol(),OP_BUY,Lotz,Ask,Slippage ,aStopLoss,aTakeProfit,TicketComment,MagicNumber,0 ,Green); err=GetLastError(); if(err==0) { if(ticket>0) break; } else { if(err==0 || err==4 || err==136 || err==137 || err==138 || err==146) //Busy errors { Sleep(5000); continue; } else //normal error { if(ticket>0) break; } } } } if(type==OP_SELL) { for(c=0;c<NumberOfTries;c++) { ticket=OrderSend(Symbol(),OP_SELL,Lotz,Bid,Slippag e,bStopLoss,bTakeProfit,TicketComment,MagicNumber, 0,Red); err=GetLastError(); if(err==0) { if(ticket>0) break; } else { if(err==0 || err==4 || err==136 || err==137 || err==138 || err==146) //Busy errors { Sleep(5000); continue; } else //normal error { if(ticket>0) break; } } } } return(ticket); } //----------------------- CLOSE ORDER FUNCTION void subCloseOrder(int TYPE) { int NumberOfTries=10, cnt, total = 0, ticket = 0, err = 0, c = 0; total = OrdersTotal(); for(cnt=total-1;cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()==TYPE&&OrderSymbol() == Symbol() && OrderMagicNumber()==MagicNumber) { switch(OrderType()) { case OP_BUY : for(c=0;c<NumberOfTries;c++) { ticket=OrderClose(OrderTicket(),OrderLots(),Bid,Sl ippage,Violet); err=GetLastError(); if(err==0) { if(ticket>0) break; } else { if(err==0 || err==4 || err==136 || err==137 || err==138 || err==146) //Busy errors { Sleep(5000); continue; } else //normal error { if(ticket>0) break; } } } break; case OP_SELL : for(c=0;c<NumberOfTries;c++) { ticket=OrderClose(OrderTicket(),OrderLots(),Ask,Sl ippage,Violet); err=GetLastError(); if(err==0) { if(ticket>0) break; } else { if(err==0 || err==4 || err==136 || err==137 || err==138 || err==146) //Busy errors { Sleep(5000); continue; } else //normal error { if(ticket>0) break; } } } break; case OP_BUYLIMIT : case OP_BUYSTOP : case OP_SELLLIMIT: case OP_SELLSTOP : OrderDelete(OrderTicket()); } } } } int subTotalTrade() { int cnt, total = 0; for(cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) total++; } return(total); } void subTrailingStop(int Type) { if(Type==OP_BUY) // buy position is opened { //----------------------- AFTER PROFIT TRAILING STOP if(Bid-OrderOpenPrice()>Point*TSMinProfit && OrderStopLoss()<Bid-Point*TrailingStop) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green); return(0); } } if(Type==OP_SELL) // sell position is opened { //----------------------- TRAILING STOP AFTER PROFIT if(OrderOpenPrice()-Ask>Point*TSMinProfit) { if(OrderStopLoss()>Ask+Point*TrailingStop || OrderStopLoss()==0) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red); return(0); } } } } //+------------------------------------------------------------------+ //End End End End End End End End End End End End| //+------------------------------------------------------------------+ |
|
||||
|
Quote:
Example: PHP Code:
Hope this helps. ![]() |
|
||||
|
Why can't I pull the values from an indicator
I'm attaching a blank EA that will put the values, or so I thought, of the indicator in a comment section.
The indicator in question is TrendStrength_v2.mq4. I can't post it because it belongs to Igorad and I don't have his permission. But, in the secure forum where he posted it ( I don't remember where ) is the source code. Igorad, if you need it, let me know. I can get it to you. I'm trying to pull values but All I get are the same values over and over again. put the EA in a backtest just to grab values and you'll see what I mean. If anyone has this indicator, are you getting the same problems? Any help would be great! THANKS IN ADVANCE! |
|
|||
|
Retracement: piece of code needed
Hi All,
I wonder if somebody has a piece of mql coding (or help me to make it ) for retracement implementation.Here is what I need exactly (for BUY). Let's have 15 min chart, shouldn't matter actually and a High for period from T1 to T2. Now, my current price is equal to that High, but I don't want to enter that breakout because I'm smart and want to wait for price's retracement (pullback). Then the future price makes a new High I'll wait for next candle to open and then that new candle makes another new High only then I enter. What worries me in coding is obviouosely I want everything to be happened withing several candles. If price goes all a way down (opposite direction) and then back up I don't want that breakout triggered at all. I probably want too much. Thanks, Orest |
|
|||
|
How does one add the LSMA to EA'S
I am new to this code writing stuff. But the EMA Cross.mq4. only use the EMA as is its trend. How can I add or change the trend to the LSMA? This trend indicator seems to be more reliable than the EMA or the others that are offer in the MQ4 language. Where does one find the code for this LSMA and where do you place it in the code. I would like to add the LSMA to this EA also. The 100 pips. Any ideas? Here is some of the code for the 100 pips. I beleive that this is where the EA find the trend.
if(timeframe==0) {timeframe=Period();} double diClose0=iClose(Symbol(),timeframe,0); double diMA1=iMA(Symbol(),timeframe,7,0,MODE_SMA,PRICE_OP EN,0); double diClose2=iClose(Symbol(),timeframe,0); double diMA3=iMA(Symbol(),timeframe,6,0,MODE_SMA,PRICE_OP EN,0); As you can see the 100 pips uses the SMA. How do we change that to the LSMA the language does not support that indicator or does it? Iam lost. Moving Average calculation method used with iAlligator(), iEnvelopes(), iEnvelopesOnArray, iForce(), iGator(), iMA(), iMAOnArray(), iStdDev(), iStdDevOnArray(), iStochastic() indicators. It can be any of the following values: Constant Value Description MODE_SMA 0 Simple moving average, MODE_EMA 1 Exponential moving average, MODE_SMMA 2 Smoothed moving average, MODE_LWMA 3 Linear weighted moving average. Last edited by i2trader; 09-19-2008 at 04:53 PM. Reason: want to attach files |
![]() |
| Bookmarks |
| Tags |
| candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
|
||||
| Posted By | For | Type | Date | |
| Need an experienced programmer? - Page 2 | Post #0 | Refback | 09-24-2008 07:24 AM | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 05:22 PM |