Looking for a range based MM system to be coded

 

Gidday

I am looking for a mm system that is based on using the daily range as the TP and SL.

They way I am looking for it to work is the greater the range the more of the FreeMargin is risked and vice versa.

I have attempted to code it my self but have had a bit of trouble

My maths might be wrong but this is what I am looking to acheive.

bar2

H = 1.64947

L = 1.64889

Range = H-L = 58

bar1

H = 1.64922

L = 1.64771

Range = H-L = 151

Percentage Risk = 151-58/151=0.61*100=61%

if there is $1250free margin I would like to the Percentage Risk as above the differance between bar ranges so 1250*61% = 762.5 risked on the next trade.

the Tick value is 10 so $762.5/10 = 76.25 pips ? i thinks

the range is 151 from the previous bar so w divide 76.25/151= 0.50 so my lot size is 0.50.

double Range = (H-L);

Can this be coded

Cheers

Kiwi

Reason: