| 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 |
|
||||
|
Thanks Wolfe
That helped alot but has open a new problem lol it now buys but no sell well not in the right place. I have been trying to buy what all three indi are blue and sell when all red.I think I have picked the right name "The Abyss" for the ea. as that is where I am sitting trying to code my way out. LOL 2007.11.24 10:14:44 2007.11.23 12:00 The Abyss EURUSD,H4: Error opening SELL order : 0 void CheckForSignals() { double TML=iCustom(NULL,0,"TrendManager",TM_Period,TM_Shi ft,0,shift); double TMS=iCustom(NULL,0,"TrendManager",TM_Period,TM_Shi ft,1,shift); double hasOpenLong=iCustom(NULL,0,"Heiken_Ashi_Smoothed", MaMetod,MaPeriod,MaPeriod2,1,shift) ; double hasCloseLong=iCustom(NULL,0,"Heiken_Ashi_Smoothed" ,MaMetod,MaPeriod,MaPeriod2,3,shift) ; double hasOpenShort=iCustom(NULL,0,"Heiken_Ashi_Smoothed" ,MaMetod,MaPeriod,MaPeriod2,0,shift) ; double hasCloseShort=iCustom(NULL,0,"Heiken_Ashi_Smoothed ",MaMetod,MaPeriod,MaPeriod2,2,shift) ; double SDLL=iCustom(NULL,0,"Slope Direction Line",period,method,price,0,shift); double SDLS=iCustom(NULL,0,"Slope Direction Line",period,method,price,1,shift); buysig=false; sellsig=false; closebuy=false; closesell=false; bool Long1 = TML; bool Short1 = TMS; bool Long2 = SDLL; bool Short2 = SDLS; bool Long3 = hasOpenLong > hasCloseLong; bool Short3 = hasOpenShort < hasCloseShort; buysig = Long1 && Long2 && Long3; sellsig = Short1 && Short2 && Short3; closebuy=sellsig; closesell=buysig; } void CheckForOpen() { if (last==Time[0]) return; int res,ord; double entry,stop; ord=CalculateCurrentOrders(); if (ord!=0) CheckForClose(); //---- buy conditions if (buys< buysig) { res=OpenAtMarket(OP_BUY,Lots); if (res<0) Print("Error opening BUY order : ",(GetLastError())); else last=Time[0]; } //---- sell conditions if (sells< sellsig) { res=OpenAtMarket(OP_SELL,Lots); if (res<=0) Print("Error opening SELL order : ",(GetLastError())); else last=Time[0]; } } int OpenAtMarket(int mode,double lot) { int tr,col; double openprice; tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); } RefreshRates(); if (mode==OP_SELL) { openprice=Bid; col=Red; } else { //openprice=nd(Ask); openprice=Ask; col=Blue; } OrderSend(Symbol(),mode,lot,openprice,slippage,sl, tp,EAName+Magic,Magic,0,col); } return; //+------------------------------------------------------------------+ //| Check for close order conditions | //+------------------------------------------------------------------+ void CheckForClose() { int total; //---- total=OrdersTotal(); for(int i=total;i>=0;i--) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderMagicNumber()!=Magic || OrderSymbol()!=Symbol()) continue; //---- check order type if(OrderType()==OP_BUY && closebuy) CloseAtMarket(OrderTicket(),OrderLots()); if(OrderType()==OP_SELL && closesell) CloseAtMarket(OrderTicket(),OrderLots()); } } bool CloseAtMarket(int ticket,double lot) { bool bres=false; int tr; tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); } RefreshRates(); bres=OrderClose(ticket,lot,OrderClosePrice(),slipp age,White); if (!bres) Print("Error closing order : ",(GetLastError())); } |
|
|||
|
Yes, it may be that; all depend of what you are intended to do...
|
|
|||
|
Dear all:
I'm building a system I think it is very good, I tested the idea before for 3 months, Now I'm trying to coding an indicator which will be asap in the forum so we can test it and it will really will make good money i think: Plz help me for now to convert these lines into mql4 coding: 1- I have vairable X , this will have a value and I'm calculating it now SO We have X as an Integer 2- the indicator must check the currnet GMT Time, It must be 6:00am GMT - Time Frame 1 H -- check GMT TIME 6:00am, WHEN this candle close, we need to calculate the following Variable Of this candle: High - Low = A A / 2 = B B - High = C = SL D = X * 30% Buy_Entry= D + C Buy_Target= C + (X * 60%) Sell_Entry= C - D Sell _Target= C - (X * 60%) Then: I want to drow the result as lines on the chart with GreaN Area for buy and red Area for Short According to Entry for Buy and Sell and SL these must be automaticly apear as soon as GMT 6:00 candle finished , Time Frame 1H, so caluculation must be according to 6:00 to 6:59am GMT Candle high and low PLZ Convert this to MQL4, so i can test it and get back again to puplish the result THANKS ALOT |
|
||||
|
Quote:
Good luck, we all have had our own versions of "the Abyss"! ![]() |
|
|||
|
i need a little help.. how do i make it work? i tried but it won't read the mins? i i should use something else aside from TimeHour but what?
Quote:
|
|
|||
|
Quote:
if (TimeHour(Clocks) == 7) { switch (TimeMinute(Clocks) { case 15 : B = 1; break; case 30 : B = 2; break; case 45 : B = 3; } } if (TimeHour(Clocks) == 8) { switch (TimkeMinute(Clocks) { case 0 : B = 4; break; case 15 : B = 5; break; case 30 : B = 6; } } Otherwise 7:17 would also set a value of 1 to B. Robert Last edited by MrPip; 11-25-2007 at 07:39 PM. Reason: fix typo |
![]() |
| Bookmarks |
| Tags |
| CHinGsMAroonCLK, I_XO_A_H |
| 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 06: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 04:22 PM |