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

Re: Coding MaxLoss and ProfitTarget Stops



PureBytes Links

Trading Reference Links

Herman

Modified profit stop with a few more options. 

Roy
 
  {Profit Exit - enter on Close}
Equity:=Input("{Set each default as required}   
Trade equity $",500,50000,5000);
Profit:=Input("Profit target %",1,50,13)/100;
Costs:= Input("Comission per trade $",0,99,30);
Xp:= Input("Exit, 1=Open 2=Close 3=Stop",1,3,3);
ExitPrice:=If(Xp=1,O,If(Xp=2,C,H));
Factor:=((Equity*(1+Profit)+Costs)/(Equity- Costs));
Entry:=Fml("Your Long Entry Binary");
EntryAmt:=If(PREV<=0,If(Entry>0,CLOSE,0),
  If(ExitPrice>=PREV*Factor,-PREV,PREV));
Target:=Abs(EntryAmt)*Factor;
EntryAmt<0 AND ExitPrice>=Target;
  {Two alternative last lines}
{If(EntryAmt<0 AND ExitPrice>=Target,1,0);}
{If(EntryAmt<0 AND ExitPrice>=Target,Target,0);}