| 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 still have a loop - darn it. I am going to crash. Tomorrow is another day. This low level language is the pits to learn.
Dave <><<< ///////////////////MODIFY STOP LOSS & TAKE PROFIT AT START OF SLEEP CYCLE ///////////////// for (int cnt1=OrdersTotal()-1;cnt1>=0;cnt1--) OrderSelect(cnt1, SELECT_BY_POS, MODE_TRADES); if (OrderType()>=OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0)) { if(OrderOpenPrice()-Ask>=TrailingStop*Point) { if(OrderStopLoss()>Ask+Point*15||OrderStopLoss()== 0) OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(15 *Point),Bid-(20*Point),Cyan); //Modify stop loss and take profit } return(0); } if (OrderType()>=OP_BUY && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0)) { if(Bid-OrderOpenPrice()>=TrailingStop*Point) { if(OrderStopLoss()<Bid-Point*15 ||OrderStopLoss()==0) OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(15*Point),Ask+(20*Point),Cyan); //Modify stop loss and take profit } return(0); } return(0); } } ////////////////////////////////////////////////////////////////////////////////////// My coding as it stands above. There is a bug in it that causes a modification loop. Many bugs or additions have brought it to this stage. Please help find the loop bug somebody! |
|
||||
|
The original design is to tighten up the stop losses and take profits on any open buy or sell orders when the program is about to go into its sleep mode.
Instead of a large 40 - 50 pip stop loss and a large 100 pip take profit in each open trade, I wanted each open trades be reduced to a 15 pip stop loss, and the take profit of 100 be reduced to a 25 pip take profit. Then the program would sleep (stop) and the open trades would run their course without any further program intervention (sleep mode) - Each open trade would then make either a 25 pip profit or make a 15 pip loss and close themselves out. I hope this helps clarify the purpose of the stop loss and take profit modification. I am sorry for the misunderstanding. Please help if you will to accomplish these modifications! Thanks so much for your help up to now! Boy, did need the sleep last night myself! Dave <><<< |
|
|||
|
Quote:
and then end your code by typing "[ /PHP ]" without the quotes and remove the spaces within the square brackets. See what you get ![]() |
|
||||
|
Quote:
The PHP button? Is this located on the forum side or the MetaEditor from which I am copying the code from?? I cannot find a PHP button on the MetaEditor. Dave <><<< |
|
||||
|
PHP Code:
Dave <><<< |
|
||||
|
PHP Code:
Last edited by iscuba11; 08-30-2006 at 05:33 PM. |
|
|||
|
For trailingstops, use the following function. I think it is written in a way that can be understood easily. Sometimes programming geeks write code, that may be efficient by a fraction of a millisecond, but makes it a darn difficult job to read and debug.
PHP Code:
TrailingAlls(TrailStartPips,TrailStopPips); |
![]() |
| Bookmarks |
| Tags |
| histogram, forex, ZUP_v1.mq4 |
| 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 10:53 PM | |
| Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart | This thread | Refback | 12-08-2007 12:46 PM | |