| 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 (2) | Thread Tools | Display Modes |
|
|||
|
I have an indicator similar to this one. Does anybody know how to pass it's values to EA? I've tried to use buffer, this way
double Trend[]; ... SetIndexBuffer(0,Trend); ... Trend[0]=UpRating; return(0); } I don't know if it works but I know that all indicator's inscription has gone. Any ideas about it? |
|
|||
|
need modification help
Hello fellow trader
I need help with this code. current function is to close first open orders by time and any following orders, mean it could be more than 2 orders closed in the same time. Question: how do I change it to make it close the FIRST 2 open orders by time ONLY. here the code. thanks for help //+------------------------------------------------------------------+ //| Close Condition Type 2 | //+------------------------------------------------------------------+ void CheckCloseConditionType2() { int Orders[]; int i, j; ArrayResize(Orders, 0); int cnt = OrdersTotal(); for (i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if (OrderSymbol() != Symbol()) continue; if (OrderMagicNumber() != Magic) continue; int type = OrderType(); if (type == OP_BUY || type == OP_SELL) { int size = ArraySize(Orders); ArrayResize(Orders, size+1); Orders[size] = OrderTicket(); } } //----- size = ArraySize(Orders); for (i=0; i < size; i++) { if (!OrderSelect(Orders[i], SELECT_BY_TICKET)) continue; if (OrderCloseTime() > 0) continue; datetime tm1 = OrderOpenTime(); for (j=i+1; j < size; j++) { if (!OrderSelect(Orders[j], SELECT_BY_TICKET)) continue; if (OrderCloseTime() > 0) continue; datetime tm2 = OrderOpenTime(); if (tm1 > tm2) { int ticket = Orders[i]; Orders[i] = Orders[j]; Orders[j] = ticket; } } } //----- for (i = size-1; i >= 1; i--) { double Profit = ArrayGetOrdersProfit(Orders); if ((Profit >= TotalTakeProfit && TotalTakeProfit > 0) || (Profit >= Profit2Exit && Profit2Exit > 0)) { Print("[Enter] Close by condition Type2"); string msg1 = ""; string msg2 = ""; double P; double T.P = 0; for (j=0; j < size; j++) { if (Orders[j] == -1) continue; if (!OrderSelect(Orders[j], SELECT_BY_TICKET)) continue; if (OrderCloseTime() > 0) continue; if (StringLen(msg1) > 0) msg1 = msg1 + " + "; msg1 = msg1 + "order " +Orders[j]; GetOrderProfit(Orders[j], P); if (StringLen(msg2) > 0) msg2 = msg2 + " + "; msg2 = msg2 +DoubleToStr(P, 2); T.P += P; } Print("Close: " + msg1); Print("Profit: " + msg2 + " = " + DoubleToStr(T.P, 2)); ArrayCloseOrders(Orders); Print("[Exit] Close by condition Type2"); return; } Orders[i] = -1; } }
__________________
creativity + common sense + a bit of humor = lots of pipp |
|
||||
|
How to count the numbers of pips
Hi,
I realized that after the market has gone for a great moves (up or down trend). The remaining market is somehow risky to trade with. I am trying to program an EA to avoid entering any trades say after a great move of about 90pips. I need to know how to calculate the number of pips from first bar at 8am (london market open) to the current bar. If the market has already been moved for more than 90pips I will not take any trade. Can someone code a few line to give me some clues? Many thanks and appreciated. Shek
__________________
http://pippingshek.blogspot.com/ |
|
|||
|
Quote:
PHP Code:
PHP Code:
|
|
||||
|
I try to add a new feature to this indicator High_Low (Zigzag) V2 so that for every time its formed a new high-low the ZZ will alert me. Don't know where it go wrong. The indi instead doesn't show up on my screen. Anyone?? Help me please.. I'm new to coding, please refine what I have done so that the indi will do just like what I want in the above. Here's the code.
High_Low v2 (ZigZag) with Alert.mq4 |
|
|||
|
Quote:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
Last edited by Michel; 04-24-2008 at 07:50 PM. |
|
|||
|
hi there!
can some here help me add this function. Make it to close trade when the bar is completed or in another word to make it close the trade when the next bar appear.( doesnt matter the trade is profit or loss ) extern int SystemMagicNumber=197; extern double TakeProfit = 100; extern double StopLoss = 500; extern double Lots=0.1; extern double TrailingStop = 0; extern int MaxBuyTrades=5; extern int MaxSellTrades=5; int start() { if( HavePosThisBar(SystemMagicNumber)==false &&iMA(NULL,0,5,0,MODE_SMA, PRICE_CLOSE,1)<iMA(NULL,0,15,0,MODE_EMA, PRICE_CLOSE,1) && iMA(NULL,0,5,0,MODE_SMA, PRICE_CLOSE,2)>iMA(NULL,0,15,0,MODE_EMA, PRICE_CLOSE,2) && SellPositionsCount()<MaxSellTrades ) { OrderSend(Symbol(),OP_SELL,Lots,Bid,0,Bid+StopLoss *Point,Bid-TakeProfit*Point,"",SystemMagicNumber,0,Red); return(0); } if( HavePosThisBar(SystemMagicNumber)==false && iMA(NULL,0,5,0,MODE_SMA, PRICE_CLOSE,1)>iMA(NULL,0,15,0,MODE_EMA, PRICE_CLOSE,1) && iMA(NULL,0,5,0,MODE_SMA, PRICE_CLOSE,2)<iMA(NULL,0,15,0,MODE_EMA, PRICE_CLOSE,2) && BuyPositionsCount()<MaxBuyTrades ) { OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",SystemMagic Number,0,Blue); return(0); } for(int cnt=OrdersTotal()-1;cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol()) { if (OrderType()==OP_SELL) { if (TrailingStop>0) { if (OrderOpenPrice()-Ask>TrailingStop*Point) { if (OrderStopLoss() == 0 || OrderStopLoss()>(Ask+Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Purple); return(0); } } } } if (OrderType()==OP_BUY) { if (TrailingStop>0) { if (Bid-OrderOpenPrice()>TrailingStop*Point) { if (OrderStopLoss()<(Bid-Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Yellow); return(0); } } } } } } //---- return(0); } //+------------------------------------------------------------------+ bool HavePosThisBar(int magic) { int cnt; bool Result=false; for(cnt=0; cnt<=OrdersHistoryTotal()-1; cnt++) if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY)) if((OrderSymbol() == Symbol()) &&(OrderMagicNumber() == magic) && Time[0]<=OrderOpenTime()) { Result=true; break; } for(cnt=0; cnt<=OrdersTotal()-1; cnt++) if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) if((OrderSymbol() == Symbol()) &&(OrderMagicNumber() == magic) && Time[0]<=OrderOpenTime()) { Result=true; break; } return(Result); } int BuyPositionsCount() { int Result=0; for(int cnt=0; cnt<=OrdersTotal()-1; cnt++) if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) if((OrderSymbol() == Symbol()) &&(OrderMagicNumber() == SystemMagicNumber) && (OrderType()==OP_BUY) ) { Result++; } return(Result); } int SellPositionsCount() { int Result=0; for(int cnt=0; cnt<=OrdersTotal()-1; cnt++) if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) if((OrderSymbol() == Symbol()) &&(OrderMagicNumber() == SystemMagicNumber) && (OrderType()==OP_SELL) ) { Result++; } return(Result); } |
![]() |
| Bookmarks |
| Tags |
| histogram |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
|
||||
| Posted By | For | Type | Date | |
| OzFx System:) - Page 639 | This thread | Refback | 06-21-2008 09:53 PM | |
| Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart | This thread | Refback | 12-08-2007 11:46 AM | |