Hi All,
I have a variable named "Days_Till_Sell" that I want to set every time
a BUY
is triggered.
PROBLEM: I need that variable to stay the same value until it is set
again at the next BUY signal. I use this variable to compute "days
until sell".
//*********************************************
//Buy logic: Short term trend cross and within first 5 days of the month
Buy = cross(Ma(c,10),ma(c,30)) and day() < 6
//Save the date value when a BUY is trggered...
DayBought = Buy * Day()
// Set how many days to hold before selling
Days_Till_Sell = ((DayBought==1) * 10) + //if bought onday 1, hold for 10
((DayBought==2) * 9) + //if bought onday 2, hold for 9
((DayBought==3) * 8) + //if bought onday 3, hold for 8
((DayBought==4) * 7) + //if bought onday 4, hold for 7
((DayBought==5) * 6); //if bought onday 5, hold for 6
//Sell only on Time based stop ( Further Below)
Sell = 0;
//Sell after n Bars
ApplyStop(StopTypeNBar, StopModeBars, DaysToSell);
//********************************************
Problem is that "DayBought" and "DaysToSell" become 'zero' for every day
other than the BUY day. I need to maintain these arrays with the same
values
until I change them at the next BUY.
Struggled for many hours with this :-(
Any ideas ?
Any Help is appreciated,
Gosub283
Calgary
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/