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

Re: [amibroker] Buy Sell Arrows or Not?



PureBytes Links

Trading Reference Links

Ken,

Yes it should read:
> PlotShapes(IIf(Sell==1,shapeDownArrow ,shapeNone),4,0,C,-8);
> PlotShapes(IIf(Sell==2,shapeDownTriangle,shapeNone),9,0,C,-20);

(if you want to DISTINGUISH between regular exits and "by stop" exits)
Better yet is to write:
> PlotShapes(IIf(Sell==1,shapeDownArrow ,shapeNone),4,0,C,-8);
> PlotShapes(IIf(Sell>=2,shapeDownTriangle,shapeNone),9,0,C,-20);

Because it handles all kinds of stops (not only max-loss).

Remember than in AFL "true" is ANY VALUE different than zero. While 
"False" is zero.

If you write just 
PlotShapes(IIf(Sell ,shapeDownArrow ,shapeNone),4,0,C,-8);
Then arrow will be plotted in case of ANY sell (no matter if regular or
generated by stop)

To your last question:
Yes, "Show arrows for actual trades" shows just arrows  (not triangles) for all trades
no matter what reason for closing was. 
I may consider changing this in the future.


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Ken Close" <closeks@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Cc: <improvements@xxxxxxxxxxxxx>
Sent: Tuesday, May 06, 2003 10:54 PM
Subject: RE: [amibroker] Buy Sell Arrows or Not?


> TJ:
> 
> It seems to me that both statements are needed if one want to plot BOTH
> Sell arrows when Sells occur and StopLoss Arrows when stop loss exits
> occur.  I thought the Sell==2 took care of distinquishing between the
> two.
> 
> Perhaps it could read
> 
> > PlotShapes(IIf(Sell==1,shapeDownArrow ,shapeNone),4,0,C,-8);
> > PlotShapes(IIf(Sell==2,shapeUpTriangle,shapeNone),9,0,C,-20);
> 
> Arrow for a SELL, triangle for a StopLoss Exit.
> 
> This raises interesting question....the normal signals in Backtester do
> not automatically display any kind of symbol on the price plot for
> ApplyStop exits.  Any chance for that being an addition in some later
> improvement?
> 
> Ken
> 
> 
> 
> -----Original Message-----
> From: Tomasz Janeczko [mailto:amibroker@xxxxxx] 
> Sent: Tuesday, May 06, 2003 2:35 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker] Buy Sell Arrows or Not?
> 
> Hello,
> 
> Your code does NOT duplicate the display of AA because it is DIFFERENT
> and can generate incorrect extra arrows.
> For example:
> In case of exit generated by stop your code generates TWO arrows instead
> of ONE because BOTH 
> > PlotShapes(IIf(Sell,shapeDownArrow ,shapeNone),4,0,C,-8);
> > PlotShapes(IIf(Sell==2,shapeUpTriangle,shapeNone),9,0,C,-20);
> 
> condtions are met so both down arrow and up triangle are plotted
> 
> Not surprising it would result in arrows that don't match.
> 
> 
> If you want to duplicate the display of AA "show actual trade arrows"
> you must use the following code:
> 
> Buy=....;
> 
> Cover= ....
> 
> Sell = ....;
> 
> Short=....;
> 
> ApplyStop(stopTypeLoss,stopModePercent,13,0);
> 
> E = Equity(1);
> 
> Plot( Close, "Price", colorBlack, styleCandle );
> 
> PlotShapes(IIf(Buy,shapeUpArrow ,shapeNone),colorGreen, 0, Low );
> 
> PlotShapes(IIf(Short,shapeHollowDownArrow
> ,shapeNone),colorRed,0,High,-24);
> 
> PlotShapes(IIf(Sell,shapeDownArrow ,shapeNone),colorRed,0,High);
> 
> PlotShapes(IIf(Cover,shapeHollowUpArrow
> ,shapeNone),colorGreen,0,Low,-24);
> 
> 
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Ken Close" <closeks@xxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Cc: "'Tomasz Janeczko'" <tj@xxxxxxxxxxxxx>
> Sent: Monday, May 05, 2003 9:30 PM
> Subject: RE: [amibroker] Buy Sell Arrows or Not?
> 
> 
> > TJ/Jayson:
> > 
> > Here are the statements from IB that produced the same trade arrows as
> > in the Price window when clicking "Show actual trades". (Show Actual
> > Trades shift right 1 bar because of operating on the Open Delay =1.
> > 
> > 
> > ApplyStop(stopTypeLoss,stopModePercent,13,0);
> > E = Equity(1);
> > PlotShapes(IIf(Buy,shapeUpArrow ,shapeNone),5,0,C,-25);
> > PlotShapes(IIf(Short,shapeHollowDownArrow ,shapeNone),4,0,C,-20);
> > PlotShapes(IIf(Sell,shapeDownArrow ,shapeNone),4,0,C,-8);
> > PlotShapes(IIf(Cover,shapeHollowUpArrow ,shapeNone),5,0,C,-14);
> > PlotShapes(IIf(Sell==2,shapeUpTriangle,shapeNone),9,0,C,-20);
> > PlotShapes(IIf(Cover==2,shapeDownTriangle,shapeNone),2,0,C,-20);
> > 
> > As I said in my note, all trades are accounted for in the AA grid and
> > they match the plotted arrows EXCEPT in the cases where I said there
> is
> > not a corresponding arrow to Cover a Short or Sell and Long.  I also
> see
> > that most times, the trade arrows are matched, but other times (fewer)
> > they do not match (again, EVEN THOU THE AA GRID SHOWS THE EXIT (either
> > Sell or Cover).
> > 
> > Thanks for the responses....this continues to be puzzling.
> > 
> > Ken
> > 
> > PS:  if you think you need to see my detailed code statements above
> the
> > Plotshape statements, all I would ask is why the AA grid shows an exit
> > (Sell or Cover) but there is not a corresponding arrow on the price
> grid
> > or in my IB??
> > 
> > -----Original Message-----
> > From: Tomasz Janeczko [mailto:amibroker@xxxxxx] 
> > Sent: Monday, May 05, 2003 2:13 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: Re: [amibroker] Buy Sell Arrows or Not?
> > 
> > Ken,
> > 
> > > As I have been implementing exact trade arrows (including
> Applystops)
> > > within Indicator Builder to match what is in the Price chart, I have
> > > come upon many cases of a trade being reversed **WITHOUT** a
> > > corresponding trade arrow being shown.
> > 
> > Did you use "Show Actual trades" in AA ?
> > Or were using PlotShapes to produce this chart?
> > 
> > If you are using PlotShapes you have to have 4 separate statements
> > to plot arrows the same way as AA window.
> > 
> > But because you didn't provide details how did you produce the
> > picture you have sent it is impossible to tell.
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "Ken Close" <closeks@xxxxxxxx>
> > To: "AmiBroker List" <amibroker@xxxxxxxxxxxxxxx>
> > Cc: "'Tomasz Janeczko'" <tj@xxxxxxxxxxxxx>
> > Sent: Monday, May 05, 2003 8:03 PM
> > Subject: [amibroker] Buy Sell Arrows or Not?
> > 
> > 
> > > Still another basic question based on a puzzling observation: I
> > thought
> > > that all trades had to have or show corresponding trade arrows on
> the
> > > price chart when using either Raw Signals or Actual Trades.
> > > 
> > > If I have a long and later exit by Selling, then the Price Chart
> will
> > > show a Long (Solid green up arrow) followed by a Sell (Solid Red
> Down
> > > Arrow).
> > > 
> > > I did not think I could see a trade arrow without its corresponding
> > exit
> > > or close trade arrow.  In other words, every Buy arrow must be
> > followed
> > > by a Sell Arrow (even if a Short arrow is on the same bar).  Every
> > Short
> > > Arrow must be followed by a Cover arrow, even if a Buy arrow is on
> the
> > > same bar.
> > > 
> > > As I have been implementing exact trade arrows (including
> Applystops)
> > > within Indicator Builder to match what is in the Price chart, I have
> > > come upon many cases of a trade being reversed **WITHOUT** a
> > > corresponding trade arrow being shown.
> > > 
> > > The attachments gives an example.  The AA results grid shows the
> trade
> > > being exited but there is no corresponding exit trade arrow.  At
> other
> > > times there is a paired comparison on entering and exiting the trade
> > > (whether long or short).
> > > 
> > > Is this an inconsistency in the program or is there a minute rule
> that
> > > dictates when these arrows are "paired up" and when they are not.
> My
> > > Plotshape arrows follow the same "anomaly", that is, they match the
> > Raw
> > > Signals arrow for arrow.
> > > 
> > > I suspect some twist in the Equity(1) routine, but who knows?
> > > 
> > > Ideas?
> > > 
> > > Ken
> > > 
> > > 
> > > 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/ 
> > > 
> > > 
> > 
> > 
> > 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/ 
> > 
> > 
> > 
> > 
> > 
> > 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/ 
> > 
> > 
> > 
> 
> 
> 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/ 
> 
> 
> 
> 
>

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/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/