Sydney
Experience: Intermediate
Platform: Multichart
Trading: Gold
Posts: 26 since Aug 2016
Thanks Given: 22
Thanks Received: 4
|
//Position Sizing - Fixed fractional
Inputs: Capital( 100000 ), PercentAllocationPerTrade( .02 ), RiskPertrade( 1 );
Var: ShareAmount( 0 ), Equity( 0 );
Equity = Round((Capital + NetProfit + OpenPositionProfit),0);
ShareAmount = Round((PercentAllocationPerTrade * Equity) / RiskPertrade,0);
If Marketposition = 0 then begin
If rsi(close,2) crosses below 30 then begin
buy ShareAmount shares next bar at market;
Value2 = ShareAmount;
end;
end;
If Marketposition = 1 then begin
if rsi(close,2) crosses above 70 then begin
sell value2 shares next bar at market; //you can use sell "all shares" as well
end;
end;
|