Forex
Google

Go Back   Forex Trading > Discussion Areas > Setup Questions
Forex Forum Register FAQ Members List Calendar Today's Posts


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-15-2006, 06:54 AM
Similar Similar is offline
Junior Member
 
Join Date: Jun 2006
Posts: 5
Similar is on a distinguished road
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);
   }
}
This is in logs:
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-15-2006, 07:59 AM
pipeline pipeline is offline
Member
 
Join Date: Mar 2006
Posts: 49
pipeline is on a distinguished road
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).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


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


All times are GMT. The time now is 07:03 PM.