Download MetaTrader 5

tp is set to 50 pips, but returning either positive and negative profit

To add comments, please log in or register
Store your source codes in MQL5 Storage. It is secure!
michal
10
michal 2014.01.09 22:19 

Hello, my sell orders are set to tp=50

ticket=OrderSend(symbol,OP_SELL,price,Bid,3,0,Bid-tp*Point,"my order",111, 0, Purple);

but someties it close the order when the profit is negative and it says it reached 50 pips#

# time type order size price s/l tp profit balance

167 2013.09.02 12:32 sell 86 0.50 0.83936 0.00000 0.83436 0.00 100021214.67

212 2013.11.22 12:23 t/p 86 0.50 0.83436 0.00000 0.83436 -51.44 100025985.79

I want to test my strategy but i am getting this kind of result.

I am also attaching an image with those results

image

image2

Can you please advise me what I am doing wrong?

IMPORTANT: I am getting this when trading AUDCHF, but for EURGBP I am getting correct results


Thank you

Michal

Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2014.01.09 22:42  
kirri:

Hello, my sell orders are set to tp=50


What is the Spread for AUDCHF ?
whroeder1
14480
whroeder1 2014.01.09 22:55  
kirri:
ticket=OrderSend(symbol,OP_SELL,price,Bid,3,0,Bid-tp*Point,"my order",111, 0, Purple);

  1. You are NOT setting it to 50 pips, you are setting it to 50 points. On a 5 digit broker a point is 1/10 pip. Adjust TP, SL, AND SLIPPAGE
  2. You buy at the Ask and Sell at the Bid, so your tp is including the spread.
  3. RTFM. Your variable is called price but OrderSend requires a lotsize.
    t OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit,
  4. Show the swap (and commissions) [right click on column headers] Do you really expect you can hold a position open for an entire year for free? What is Carry Trade? | Carry Trade | Freshman Year | Undergraduate
michal
10
michal 2014.01.10 00:05  
WHRoeder:
  1. You are NOT setting it to 50 pips, you are setting it to 50 points. On a 5 digit broker a point is 1/10 pip. Adjust TP, SL, AND SLIPPAGE
  2. You buy at the Ask and Sell at the Bid, so your tp is including the spread.
  3. RTFM. Your variable is called price but OrderSend requires a lotsize.
    t OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit,
  4. Show the swap (and commissions) [right click on column headers] Do you really expect you can hold a position open for an entire year for free? What is Carry Trade? | Carry Trade | Freshman Year | Undergraduate


1. I stated it wrong my tp is set to 500. so it is 50 pips.

2 for testing I am using fixed spread: 2 points

3. my price is to to 0.5 lot

4. I did not think about those comissions. Maybe it is the problem in there. But there are positions opened for 2 months and they are also negative

double price= 0.5;

int tp = 500;


RaptorUK i am using fixed spread: 2 points

Thank you guys for your quick answers and for your willingness to help

michal
10
michal 2014.01.10 00:16  
Yes, I think those commissions are the reason. When I used Buy instead of sell for my orders, so commissions are positive, I did not get those negative values. Thanks!
To add comments, please log in or register