PureBytes Links
Trading Reference Links
|
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
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|