Code: Select all
if condition1 and condition2 and condition3 and condition4 then begin
contract_size = (equity * (Risk/100)) / (close - sl);
if contract_size > max_buypower / close then
contract_size = max_buypower / close;
pt1 = close + 1 * (close - sl);
pt2 = close + 5 * (close - sl);
pt3 = close + 10 * (close - sl);
var0 = ((contract_size + currentcontracts) * close / equity) * 100;
Buy(NumToStr(var0,2) + "%") contract_size contracts next bar x limit;
end;
if close < sl - ticksl then
Sell("Initial SL") next bar on market;
if marketposition <> 0 and close >= pt1 then begin
Sell("PT1") 0.5 * currentcontracts contracts next bar on market;
end;