|
|||||||
| 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 | Thread Tools | Display Modes |
|
||||
|
Quote:
I can help to code it for u if want. |
|
||||
|
Quote:
string val_old_string = "val_old" + Symbol(); int val_old = GlobalVariableGet(val_old_string); if(val != val_old) { int pips_increment_decrement; int current_total_pips; string counter = "Pips Counter"; double pips_counter = GlobalVariableGet(counter); if (val>val_old) { pips_increment_decrement = val - val_old; current_total_pips = pips_increment_decrement + pips_counter; GlobalVariableSet(counter, current_total_pips); GlobalVariableSet(val_old_string, val); } else { pips_increment_decrement = val_old - val; current_total_pips = pips_counter - pips_increment_decrement; GlobalVariableSet(counter, current_total_pips); GlobalVariableSet(val_old_string, val); } } |
|
|||
|
Hello,
I am a complete newbie to programming. Thanks to the posts and learning resources on this site I built up courage to attempt building few EAs, one of which will use Lguerre as one of the triggers (I used this website to help me out ; Expert Advisor Builder for MetaTrader 4 ). The problem with my EA is that it won't open buy orders when triggers are hit. I have built a couple of EAs using the aforementioned site and they execute orders for long & short positions just fine (The EAs used RSI's). Please take a look at the attached EA, 3-28, and let me know what I'm doing incorrectly.... am I using the wrong format for the levels to be hit before a trade is executed? Does the Laguerre need additional parameters? I have spent an embarrassing amount of time on this and I'm on the verge of giving up.... any help is GREATLY appreciated!!!!! I seem to have found the answer... why do I need to multiply the Laguerre in my EA, though????? Last edited by rlach3 : 03-31-2008 at 03:50 PM. Reason: Update |
|
|||
|
I ran into a problem closing positions. Help please
I ran into a problem that I dont know how to solve. My program has a few open orders and closes them all together but sometimes I think that some of the orders are not filled therefore it keeps waiting till they are filled and that locks up my program. What have you guys found to be the best way to close all open orders? Thank you kindly for your help.
here is the code: int OrdersTotalLong() { int order_total = 0; for (int i = 0; i < OrdersTotal(); i++) { OrderSelect(i,SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY) order_total++; } return(order_total); } int MaxLongOrder() { int order = 0; double lotsbuyed = 0; for (int i = 0; i < OrdersTotal(); i++) { OrderSelect(i,SELECT_BY_POS, MODE_TRADES); if ((OrderType() == OP_BUY) && (OrderLots() > lotsbuyed)) { lotsbuyed = OrderLots(); order = i; } } return(order); } int CloseLong() { while (OrdersTotalLong() > 0) //until there's no Orders open (close all) { if (OrderSelect(MaxLongOrder(), SELECT_BY_POS, MODE_TRADES) == false) continue; OrderClose(OrderTicket(),OrderLots(), Bid, 3, Green); } } return(0); } |
|
||||
|
Quote:
__________________
|
|
|||
|
Quote:
Then after you place a trade obtain the price that you entered the trade at, and then with each new each tick check to see if either your stop or your target has been hit. If has been hit then have the EA execute the OrderClose function. Personally, I still have a stop that the broker can see though it is set a long way from the price action 50-100 pips. In this way if the terminal goes down for some reason, you are at least protected against any sudden moves. Cheers, Hiachiever |
|
|||
|
Quote:
A hard-stop of some degree is essential imo (for the 'just-in-case' scenario..) but even this won't save you if you have a completely unscrupulous broker - such as Fxopen: - Brokers Scam |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |