| 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 |
|
|||
|
Help on Programming
Hi,
I've been doing my bes to try programming some things, but I've hit a brick wall. So I tried something real simple. If I uncomment "Print("Five");" and test the program it will only print "Yahooooooo". (Well it prints One" as well). Now with "Print("Five");" commented out, even the "Yahooooooo" doesn't print. What am I missing?? |
|
|||
|
Close all pending and open order when 1 trade hit TP
Hi,
I'm trying to write a codes in my EA that will close all pending and open orders once there is 1 trade that hit TP. Below is the codes that I used, seems not working. Can somebody take a look and advise what is missing. Thanks. if( PreviousOpenOrders > OpenOrders ) { for( cnt = OrdersTotal()-1; cnt >= 0; cnt-- ) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); mode = OrderType(); if( OrderSymbol() == Symbol() && OrderMagicNumber()==Magic) { if( mode == OP_BUY ) OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Blue); if( mode == OP_SELL ) OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Red); if (mode == OP_SELLLIMIT) OrderDelete(OrderTicket()); if (mode == OP_BUYLIMIT) OrderDelete(OrderTicket()); } } } } |
|
|||
|
Quote:
PHP Code:
|
|
|||
|
Move Stop Once
Here is my bit of code for moving the stoploss to breakeven after a certain profit. Is there anything wrong with it?
Code:
//MoveOnce
if(MoveStopOnce && MoveStopWhenPrice > 0) {
if(Bid - OrderOpenPrice() == Point * MoveStopWhenPrice) {
OrderModify(OrderTicket(),OrderOpenPrice(), Bid - Point * MoveStopTo, OrderTakeProfit(), 0, Red);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
|
|
|||
|
People that can help:
The code for the previous bar is below: //to buy double indicatorpast = icustom(....................,1); double indicatornow = icustom(....................,0); if (close[1]<indicatorpast && close[0]>indicatornow) OpenBUY(); if (close[1]>indicatorpast && close[0]<indicatornow) OpenSELL(); but with this satatement, the expert opens positions not only when the price cross the indicator, it opens position above the indicator too. I want that the expert open position ONLY when it cross the indicator, so i tried that: //to buy double indicatorpast = icustom(....................,1); double indicatornow = icustom(....................,0); if (close[1]<indicatorpast && close[0]==indicatornow) OpenBUY(); if (close[1]>indicatorpast && close[0]==indicatornow) OpenSELL(); But this statement it is not performing. Do you know what is happen? Because i think there arent errors in the statement. The question is why is not opening at the exact point of cross when close[0]==Indicatornow? If the function would be with ==, we will prevent the open of orders above the point of crooss between the indicator and the close of the present bar but is not funtioning with this type of relationship between the variables. Do you have experimented the same problem? Abyone knows how resolve it? Thanks, again. |
|
|||
|
Quote:
|
![]() |
| 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 |