t/p is not working properly - page 4

 
krishna_gopal_2:

Are you joking ? Read the topic and answer to the questions asked !
 

Have you done ANY checking of your code? For instance, after setting the TP, do you check afterwards that it has been set correctly: 

OrderSelect

OrderTakeProfit 

These are the kind of steps that will find the problem! Not asking people who can't see your code.

If you find that the TP's are not being set, you could try setting the TP as a double variable and using that in the OrderSent function instead of calculating inside the function.

OR maybe you could try Normalizing all prices concern.

But that still doesn't answer how the trades are being closed... but there is NO ONE I can guess that without seeing the code. It's your job! 

I want to help out of curiosity but you're not helping us help... it's getting old, fast.

 
alladir:

But that still doesn't answer how the trades are being closed... but there is NO ONE I can guess that without seeing the code. It's your job! 

I want to help out of curiosity but you're not helping us help... it's getting old, fast.

          if(buy_flag && Ask<=next_trade)
                  {
                     ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,Ask+0.01,"Second_Orders",0,0,Green);
                     Total_Trades++;
                     Print("This is ",Total_Trades,"th Buy Order");                  
                  }
          else if(sell_flag && Bid>=next_trade)
                  {
                     ticket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,Bid-0.01,"Second_Orders",0,0,Green);
                     Total_Trades++;
                     Print("This is ",Total_Trades,"th Sell Order");
                  }

Result:

 120 2009.05.22 12:36 t/p 1 0.10 1.3999 0.0000 1.3999 146.20 26346.83

121 2009.05.22 14:00 sell 61 0.10 1.3990 0.0000 1.3890 0.00 26346.83

Journal:

2013.06.19 21:07:38 2009.01.05 08:21  Final_100pips_Averaging_Code EURUSD,H1: This is 2th Buy Order

2013.06.19 21:07:38 2009.01.05 08:21  Final_100pips_Averaging_Code EURUSD,H1: open #2 buy 0.10 EURUSD at 1.3788 tp: 1.3888 ok

2013.06.19 21:07:37 2009.01.02 08:00  Final_100pips_Averaging_Code EURUSD,H1: This is First Buy Order

2013.06.19 21:07:37 2009.01.02 08:00  Final_100pips_Averaging_Code EURUSD,H1: open #1 buy 0.10 EURUSD at 1.3899 tp: 1.3999 ok

2013.06.19 21:08:37 2009.05.22 12:36  Tester: take profit #1 at 1.3999 (1.4002 / 1.4004)

2013.06.19 21:08:37 2009.05.21 16:50  Tester: take profit #2 at 1.3888 (1.3895 / 1.3897)

2013.06.19 21:08:36 2009.05.20 13:55  Tester: take profit #8 at 1.3786 (1.3788 / 1.3790)

2013.06.19 21:08:36 2009.05.20 11:40  Tester: take profit #59 at 1.3686 (1.3688 / 1.3690)

2013.06.19 21:08:36 2009.05.19 06:41  Tester: take profit #60 at 1.3586 (1.3587 / 1.3589)

 This time apart from going in negative side it has gone 40 pips in positive direction. And I checked it. After placing order TP is excatly 100pips from the opening price.

 
krishna_gopal_2:

Result:

 120 2009.05.22 12:36 t/p 1 0.10 1.3999 0.0000 1.3999 146.20 26346.83

121 2009.05.22 14:00 sell 61 0.10 1.3990 0.0000 1.3890 0.00 26346.83


I still don't know what these numbers mean.

 
alladir:


I still don't know what these numbers mean.

They are a copy and paste from the Strategy Tester order history . . .  I think.
 
RaptorUK:
They are a copy and paste from the Strategy Tester order history . . .  I think.

where
line 120 will be a closing trade number 1 0.1 lots at takeprofit point 1.3999  it closed with a profit 146.2  and balance that moment 26346.83 at time  2009.05.22 12:36

line 121 opening new sell trade 'order 61' 0.1 lots at orderopenprice 1.3990  ......

 
krishna_gopal_2:

Result:

 Line    Time                  Type  Trade-Num    LotSize    OpenPrice  SL          T/P           P/L            Balance

 120    2009.05.22 12:36  t/p      1                    0.10         1.3999        0.0000    1.3999     146.20         26346.83

Journal:

2013.06.19 21:07:37 2009.01.02 08:00  Final_100pips_Averaging_Code EURUSD,H1: open #1 buy 0.10 EURUSD at 1.3899 tp: 1.3999 ok

2013.06.19 21:08:37 2009.05.22 12:36  Tester: take profit #1 at 1.3999 (1.4002 / 1.4004)

So, the profit is taken at 1.3999 and the order is initiated at 1.3899 which exactly 100pips apart. 100 + 46.20 $ is there. But only 100 or less than 100 $ should be there. I have give the code by which the order has been initiated. Is there anything wrong with this code.

As you know sometimes before I got -10$ too. Why? From all your discussions I understood that from OrderSent() with t/p of +100pips I will get something less than 100pips(due to spread) (something around 90 - 70 pips). But -10 is a big deviation. I have not changed the code. Just checked what I should as per the suggestions. While checking using OrderTakeProfit() I got 1.3999. This is also confirmed in Journal: too.

 
krishna_gopal_2:

So, the profit is taken at 1.3999 and the order is initiated at 1.3899

The figures say the order was opened at 1.3999.. not 1.3899?

Also, have you checked the actual closing price of the orders?

 
alladir:

The figures say the order was opened at 1.3999.. not 1.3899?

Also, have you checked the actual closing price of the orders?


2013.06.19 21:07:37 2009.01.02 08:00  Final_100pips_Averaging_Code EURUSD,H1: open #1 buy 0.10 EURUSD at 1.3899 tp: 1.3999 ok

 So order is opened at 1.3899 only. 

Reason: