![]() |
|
| Discuss HELP NEEDED: What's wrong with the PlotShapes in this AFL (William's Third wise Man) at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hi, I am trying to plot arrows based on Bill William's Third wise man. I ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#1
|
|||
|
|||
|
Hi,
I am trying to plot arrows based on Bill William's Third wise man. I am looking for five price bars at a time and comparing High values. If the middle high is higher than previous two highs and next two highs, I want to plot up Arrow symbol. However with the following code, I end up plotting uparrow on every bar (even when value of tmp is false). What am I doing wrong here? for( i = 3; i < (BarCount-2); i++ ) { tmp = (High[i] > High[i-1]) AND (High[i-1] > High[i-2]) AND (High[i] > High[i+1]) AND (High[i+1] > High[i+2]); //_TRACE("tmp : " + tmp); PlotShapes( IIf( tmp, shapeUpArrow, shapeNone ), colorGreen,0, H,10 ); } |
|
#2
|
|||
|
|||
|
OHLC are all arrays. You dont need to, and, should not use it as array. Just try the following :
tmp = (High > Ref(High,-1)) AND (High > Ref(High,-2)) AND (High > Ref(High,1)) AND (High > Ref(High,2)); PlotShapes( IIf( tmp, shapeUpArrow, shapeNone ), colorGreen,0, H,10 ); |
|
#3
|
|||
|
|||
|
Quote:
![]() Once again, thank you for helping me! |
|
#4
|
|||
|
|||
|
That still doesn't explain why the original code was not working. Think the for loop should have started with i=2, but is that the reason?
|
|
#5
|
|||
|
|||
|
Quote:
_SECTION_BEGIN("William's Third Wise Man"); for( i = 3; i < (BarCount-2); i++ ) { tmp[i] = (High[i] > High[i-1]) AND (High[i-1] > High[i-2]) AND (High[i] > High[i+1]) AND (High[i+1] > High[i+2]); } PlotShapes( IIf( tmp, shapeUpArrow, shapeNone ), colorGreen,0, H,10 ); _SECTION_END(); We need to store value of tmp in an array corresponding to each value of i when we use for loop. Once that is done, we then use PlotShapes() function only once (using capabilities of array in Amibroker). Best regards, Abhay |
|
#6
|
|||
|
|||
|
Quote:
But shouldn't we be using tmp[i-3] to store the array values correctly in the tmp array? Or maybe we should simply use IF-ELSE in the original code rather than IIF. Regards Last edited by kkseal; 18th July 2008 at 06:01 PM. |
|
#7
|
|||
|
|||
|
Quote:
![]() Quote:
Regards, Abhay |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Indemnity, Disclaimer & Disclosure
Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum
Rules Disclaimer & Disclosure and indemnify Traderji.com, its
associates and related parties of all claims howsoever resulting from
the usage of the forum.
• Disclaimer: Trading or investing in stocks & commodities
is a high risk activity. Any action you choose to take in the markets
is totally your own responsibility. Traderji.com will not be liable for
any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
• Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein.
The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.