take profit & stop loss modification and setting order size according to the free margin

 
Hello All! As I mentioned in my previous posts, im a total newbie, and my questions might seem stupid for some of you, but could you please explain me, if there is any way to modify take profit & stop loss levels according to the daily range of a currency(maybe using average true range, or average daily range? I guess using constant values instead of flexible levels is less fruitful? My another questions concerns setting order size according to the free margin, what I mean by this is to use constant proportion of an account, not fixed volume. I would be greatful if anyone could give my any suggestions how could I cope with these two difficulties. I hope I was clear in explaining my problems. Tomek
 

Your questions aren't regarded as stupid but we aren't going to write your code for you.

" is any way to modify take profit & stop loss levels according to the daily range of a currency " yes, there are probably more than 10 ways . . .

"My another questions concerns setting order size according to the free margin, what I mean by this is to use constant proportion of an account" yes, I have been discussing this with seemore check the thread https://www.mql5.com/en/forum/134659

 
Thanks Raptor, of course i dont expect anybody to write code for me, i just sometimes need some kind of a hint. tomek
 
tomekbuka:
Thanks Raptor, of course i dont expect anybody to write code for me, i just sometimes need some kind of a hint. tomek

hi, tomek

as an example how to employ such idea....

//look at 
 double NormalizeDouble( double value, int digits)
//mql reference
//glob var
X_DIGITS = 4 

.....................
double 
SL1 = NormalizeDouble(iATR(NULL, NULL,12,0), X_DIGITS);
SL2 = NormalizeDouble(Low[1], X_DIGITS);
    
       

double 
TP1 = NormalizeDouble(iStochastic(NULL, NULL,10,7,7,MODE_SMA,0,MODE_MAIN,0), X_DIGITS);
TP2 = NormalizeDouble(High[1], X_DIGITS);    

// pozdrawiam

Reason: