Stochastic system - Error
|
|||
|
I created a simple EA based on 15 minutes chart..The sistem is the seguent:
- when Stochastic cross over its Moving Average then buy a lot - when Stochastic cross under its Moving Average then close the long position - when Stochastic cross under its Moving Average then sell short a lot - when Stochastic cross over its Movinga Average then close the short position But I saw that when it close a position, it attend the next bar to open a contrary position...It's possibile to make that it close the position and AT THE SAME MOMENT it open a contrary position? (Stop and Reverse) Where is my error in the code? ![]() |
![]() |
|
|||
|
Quote:
I tried to write: if (Bid > (OrderOpenPrice()+TakeProfit2*Point)&& ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { OrderClose(OrderTicket(), OneLot, Bid, Slippage, MediumSeaGreen); where TakeProfit2 = 10, but it doesn't work..When I open Metatrader it is "grey"...Can anyone help me? |
|
|||
|
Quote:
![]() I usually write an ea and then I save the file as metatrader file..I miss some steps? (others eas work..) Last edited by tradetrade : 07-25-2006 at 08:04 AM. |
|
||||
|
Hey
If sleep() doesn't work, you should replace all standard ordering functions with my extended functions. Just add Ex after SelectOrder, OrderSend, OrderClose, OrderDelete, OrderModify. Example: SelectOrderEx, OrderSendEx, etc. This will eliminate many ordering problems. And, add below code to your expert: PHP Code:
|
|
||||
|
Quote:
OrderSelectEx(...) If (Bid > OrderOpenPrice() + (TakeProfitPips * Point)) { OrderClose(ticket, OneLot, Price, Slippage, Color); } Look at the bold text, especially Price. For buy order, it's Bid. For sell order, it's Ask. |
|
|||
|
Quote:
//+------------------------------------------------------------------+ //| Signal Begin(Exit Buy) | //+------------------------------------------------------------------+ if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY; //+------------------------------------------------------------------+ //| Signal End(Exit Buy) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; I tried this, but obviously it doesn't work (...): //+------------------------------------------------------------------+ //| Signal Begin(Exit Buy) | //+------------------------------------------------------------------+ if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY; //+------------------------------------------------------------------+ //| Signal End(Exit Buy) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { OrderClose(OrderTicket(), 1, Bid, Slippage, MediumSeaGreen); If (Bid > OrderOpenPrice() + (Range6 * Point)) {OrderClose(ticket, 1, Bid, 3, Red);} if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; Last edited by tradetrade : 07-25-2006 at 07:56 PM. |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Great System! FxOverEasy | scorpion | Trading Systems | 9 | 08-30-2008 03:57 PM |
| CCI + Stochastic | gazuz | Trading Systems | 19 | 03-10-2008 10:14 AM |
| Weekly breakout system ! | amarnath | Trading Systems | 6 | 09-29-2007 12:15 AM |
| ANALYTICAL SOFTWARE for Traders (March 2006) | max777 | Classified Ads | 2 | 08-20-2007 10:42 PM |
| ANALYTICAL SOFTWARE for Traders (June 2006) | max777 | Classified Ads | 0 | 06-18-2006 11:32 PM |
All times are GMT. The time now is 10:13 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now











Linear Mode

