[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code Help



PureBytes Links

Trading Reference Links

I have taken a simple system coded  as an indicator and modified it to
show the profitability in each signal. What I would like to do now is
amend this code so that I can track, cumulatively, the last value of the
current trade and all previous trades. I have made several attempts at
coding this, but have not been able to get any to work. I tried to use
the function " sumlist", but that didn't work either. Unfortunately,
because this is an an indicator and not a system, the system functions
such as I_ClosedEquity aren't applicable. Your help, as always, is much
appreciated.

Input: LenL(3), LenS(3),NumContr(1), PtVal(5);
Var: Swing(0), upper(c), lower(c);
Vars: Profits(0);
Profits =NumContr*PtVal;

Value1=Average(H, LenL);
Value2=Average(L,LenS);
upper=minlist(value1,upper[1]);
lower=maxlist(value2,lower[1]);

If C<Value2[1] And C[1]>=Value2[2] then Swing=-1;
If C>Value1[1] And C[1]<=Value1[2] then Swing=1;

if Swing=-1 then begin
 plot1((lower-c)*Profits,"Sell_Profits");
 upper=9999999;
end;

if Swing=1 then begin
 plot2((c-upper)*Profits,"Buy_Profits");
 lower=0;
end;