PureBytes Links
Trading Reference Links
|
Applystop:
type =
0 = stopTypeLoss - maximum loss stop,
1 = stopTypeProfit - profit target stop,
2 = stopTypeTrailing - trailing stop,
3 = stopTypeNBar - N-bar stop
For visual conformation of ApplyStop function, add the following lines
below your ApplyStop formula in Indicator Builder:
Equity(1); // THIS EVALUATES STOPS
Plot(Sell==4,"ApplyStop Sell",colorRed,1|styleOwnScale);
Plot(Cover==4,"ApplyStop Cover",colorGreen,1|styleOwnScale);
John Rowlinson wrote:
> Hi Leo,
>
> This is great. Is the value for a stoploss == 2? I tried this
> today. I want to plot a level 1 on my inidicator. So if I use:
>
> Graph5 = IIf(Cover==2, 1, 0);
>
> Then that should do it? I can't seem to get it to work.
>
>
>
> John
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "leo_amelc"
> <leo.timmermans.lt@xxxx> wrote:
> > John,
> >
> > Maybe this code excerpt can help you. The different stops
> > (ApplyStop) have different values that you can use is the
> PlotShapes.
> > Hope this helps.
> >
> > Regards
> > Leo
> >
> >
> > PAT = YOUR SYSTEM CONDITION HERE
> > barcolor=IIf(PAT,colorYellow,colorBlue);
> > GraphXSpace=5;
> > Plot(C,"BUY PATTERN",ValueWhen(barcolor!=0,barcolor),styleBar);
> >
> > // Backtester part
> > SetTradeDelays(0,0,0,0);
> > SetOption("AllowSameBarExit",False);
> > SetOption("ActivateStopsImmediately",False);
> > SetOption("AllowPositionShrinking",True);
> > typeLoss=2;typeProfit=3;typeTrailing=4;typeNBar=6;
> > BuyCond=PAT;
> > BuyPrice=C;
> > Buy=BuyCond;
> > SellPrice=C;
> > Sell=0; //exit by stops only
> > ApplyStop(stopTypeProfit,stopModePercent,4,True);
> > ApplyStop(stopTypeTrailing,stopModePercent,10,True);
> > ApplyStop(3,1,10); //STOP After 10Bars
> > Equity(1);
> > PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,C-ATR(1));
> > PlotShapes(IIf
> > (Sell==typeNBar,shapeDownArrow,shapeNone),colorRed,0,C+ATR(1));
> > PlotShapes(IIf
> >
> (Sell==typeProfit,shapeSmallDownTriangle,shapeNone),colorBrightGreen,
> > 0,C+ATR(1));
> > PlotShapes(IIf
> >
> (Sell==typeTrailing,shapeSmallDownTriangle,shapeNone),colorRed,0,C+AT
> > R(1));
> >
> >
> >
> > > Hello,
> > >
> > > I have an indicator that plots buy, sell etc and I want to plot
> > > stops. How do I do this? Is it something like sell==4? I am
> > > entering into positions using buy and sell and as I always have a
> > > position they reverse each other - so sell=short etc. I can't
> > find
> > > anything of much use in on-line help.
> > >
> > > Thanks for any help.
> > >
> > >
> > >
> > > John Rowlinson
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Your own Online Store Selling our Overstock.
http://us.click.yahoo.com/rZll0B/4ftFAA/46VHAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|