|
|||||||
| 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 a big trouble on management of orders....
My simple EA entry at X:59......but i have multiple entry on the same cross. My question: It's possible to check orders time entry and to compare with new order? I want entry at x:59 only with 1 order for cross.... Someone can help me? |
|
|||
|
Quote:
//+------------------------------------------------------------------+ //| Signal Begin(Entry) | //+------------------------------------------------------------------+ if (Buy1_1 < Buy1_2 && Minute()>58 && check_buy==0) Order = SIGNAL_BUY; if (Sell1_1 > Sell1_2 && Minute()>58 && check_sell==0) Order = SIGNAL_SELL; if (Minute()==00) {check_buy=0;} if (Minute()==00) {check_sell=0;} //+------------------------------------------------------------------+ //| Signal End | //+------------------------------------------------------------------+ //Buy if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { //if(!IsTrade) { //Check free margin if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (StopLossMode) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0; if (TakeProfitMode) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0; check_buy=1; Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy %W(#" + Magic_Number + ")", Magic_Number, 0, DodgerBlue); if(Ticket > 0) { if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) { Print("BUY order opened : ", OrderOpenPrice()); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy"); } else { Print("Error opening BUY order : ", GetLastError()); } } if (EachTickMode) TickCheck = True; if (!EachTickMode) BarCount = Bars; return(0); // } } //Sell if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { //if(!IsTrade) { //Check free margin if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (StopLossMode) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0; if (TakeProfitMode) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0; check_sell=1; Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell %W(#" + Magic_Number + ")", Magic_Number, 0, DeepPink); if(Ticket > 0) { if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) { Print("SELL order opened : ", OrderOpenPrice()); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell"); } else { Print("Error opening SELL order : ", GetLastError()); } } if (EachTickMode) TickCheck = True; if (!EachTickMode) BarCount = Bars; return(0); //} } if (!EachTickMode) BarCount = Bars; return(0); } //+------------------------------------------------------------------+ |
|
|||
|
How to keep track of multiple orders?
I'm currently making an EA that only has 1 open trade at a time.
I have alot of variables to keep track of what is happening during this trade. If I had more open trades at the same time I thought I could use arrays for these variables with the ticket number as key. But as I understand it the keys has to be 0,1,2,3 etc right? So this wouldn't be possible. Instead of that I could have a multidimension array like this, I hope you understand my javascript/php like description. barsSinceOpen = array( 0 => array(0 => 123123, 1 => 63) 1 => array(0 => 552352, 1 => 5) ); 0 in second dimension would be ticket number, and 1 would be amount of bars since the trade was open. barSinceOpen is just an example.. I know I could calculate this one out for each trade every time I want, but that's not the point. I have ALOT of things I keep track of for a trade. And to select the correct order I would have to iterate over the array and select the 2nd level array with correct ticket. Do you think this is a good idea? How would you do it?
__________________
boo |
|
|||
|
Another question
It seems like when I do a orderModify() to set a take profit for example.
And then before next tick or we could aswell say before I select the same order again I do another orderModify() to set a stop loss. And in that I use OrderTakeProfit() so it doesn't remove the take profit. But, It removes the take profit anyway. Do I need to wait for next tick or to select the order again for the OrderTakeProfit() to return my new take profit?
__________________
boo |
|
|||
|
re: Coding Knowledge Questions
Quote:
Quote:
(I always try to do my homework first.) Maybe I need explanation and example(s). Big Be Last edited by Big Be : 02-24-2008 at 05:08 PM. |
![]() |
| 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 |