Aroon up/down SAR strategy
Author: slin68
Creation Date: 5/21/2010 10:59 PM
profile picture

slin68

#1
I created the following script based on Aroon Up and Down indicators. When I tested it using 80% equality margin 2:1 on C, it only had 3 trades and the rest of trades not included due to insufficient simulated captical. Then Can someone tell me why?

CODE:
Please log in to see this code.


This is the result of 80% equality with 2:1 margin. My question is why the second short was covered, but not the first one. After cover short on the second, it seems IsLastPositionActive returns false. So the first short never get covered. Is there way to check if there is still position open?

Position Symbol Quantity Entry Date Entry Price Exit Date Exit Price Profit % Profit $ Bars Held Profit per Bar Entry Name Exit Name MAE % MFE %
Short C 74 1/26/2007 53.93 Open Open 91.34 $3,645.38 812 $4.49 Aroon buy short at open -3.20 98.00
Short C 83 3/1/2007 49.75 4/11/2007 52.41 -5.73 ($236.78) 29 ($8.16) Aroon buy short at open Aroon cover short at open -5.74 3.22
Long C 74 4/11/2007 52.41 Open Open -91.51 ($3,548.90) 761 ($4.66) Aroon long at open -98.36 5.78

if I change margin to 1, only the first row showed in the Trades, although there were plenty of opportunities to cover it based on the criteria. Can someone help?

Thanks
profile picture

Eugene

#2
See this Wiki link for a code pattern of stop-and-reverse system to follow:

WealthScript Techniques | Creating a Stop-And-Reverse (SAR) system

Here's your fixed code:
CODE:
Please log in to see this code.
profile picture

slin68

#3
Thank you so much for quick response! That helps. I'm new to Wealth-Lab. I'd like to learn the coding techniques such as the link you provided, but I'm still not sure how to get these references quickly. Is there a central wiki page that I can look for answers? The help manual in Wealth-Lab is helpful, but not like the one you provided. Also, no indicator reference. If you can point me some links, that'll be great. Thanks,
profile picture

Eugene

#4
* On this web site, go to Support > Knowledge Base > Wealth-Lab Wiki (indicator reference, KB, and lots more)
* WealthScript Programming Guide (Help menu)
* The QuickRef (Help menu)
profile picture

slin68

#5
Thanks again for your quick reply. This is my first post and I'm very glad that I can get quick answer for my question at this forum
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).