|
|||||||
| 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 |
|
|||
|
Help me with a function and startegy tester
This is the function:
Code:
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = Ask+(takeProfitBuy*Point);
lsComm = GetCommentForOrder();
int ticket = OrderSend(Symbol(),OP_BUY,ldLot,Ask,3,ldStop,ldTake,lsComm,MAGIC,0,CLR_NONE);
if (ticket < 0) {
Print("Error: ",GetLastError());
Print("Lots: ",ldLot," Ask: ",Ask," StopLoss: ",ldStop," TakeProfit: ",ldTake);
}
}
2006.07.15 09:41:53 2006.07.14 22:42 someEA_02 EURUSD,M15: Error: 130 2006.07.15 09:41:53 2006.07.14 22:40 someEA_02 EURUSD,M15: Lots: 0.01 Ask: 1.2651 StopLoss: 1.2498 TakeProfit: 1.2666 2006.07.15 09:41:53 2006.07.14 22:40 someEA_02 EURUSD,M15: Error: 130 2006.07.15 09:41:53 2006.07.14 22:40 someEA_02 EURUSD,M15: Lots: 0.01 Ask: 1.2652 StopLoss: 1.2499 TakeProfit: 1.2667 Where i`m wrong ? This driving me crazy from about 8 hours ![]() if ldTake = 0 - no error but no Take Profit. Last edited by Similar : 07-15-2006 at 07:00 AM. |
|
|||
|
I don't know. The problem may come from the Stop Loss, or the Take Profit: remember that it can't be too close to the price. Check with MarketInfo() that 15 pips is far away enough. Check all the variables' types (including what is returned by the functions) and make sure the takeprofit is normalized (right number of digits). Slippage issues interfering with SL/TP are not documented but might happen?
A remark: a takeprofit of 15 pips with a stop loss of 153 pips is very strange...(unless it is an emergency stop loss for ~9/11 events and you normally close the trade well before that). |
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy Tester | pete36 | Expert Advisors - Metatrader 4 | 0 | 11-25-2006 02:18 AM |
| MT4 Strategy tester | The_N | Metatrader 4 | 1 | 05-06-2006 11:32 AM |
| strategy tester | caldolegare | Metatrader 4 | 2 | 03-02-2006 10:58 PM |
| Looking for the tester | sgoloubev | General Discussion | 1 | 10-13-2005 04:41 PM |