Invalid volume with take profit = 0

 

Hi, 


I don't understand why, it's been a while i'm wondering what's the problem . I have an expert advisor that works fine if I set fixed sl and tp ; I want to remove fixed tp because I want to close my position from indicator signal , so I set request.tp = 0 as mentioned in references and the error "failed market sell [invalid volume]" appears in the log. 

I have function that check and adjust trade size, as well as stop level . 

Thank anyone who try to help me . 

 
Alex Savigni:

Hi, 


I don't understand why, it's been a while i'm wondering what's the problem . I have an expert advisor that works fine if I set fixed sl and tp ; I want to remove fixed tp because I want to close my position from indicator signal , so I set request.tp = 0 as mentioned in references and the error "failed market sell [invalid volume]" appears in the log. 

I have function that check and adjust trade size, as well as stop level . 

Thank anyone who try to help me . 

Probably the EA calculates the lot size according to the SL or TP and if you set it to 0 the calculation doesn't work correctly.