Gday folks, been a long time since I've been on here but blew the dust off the keyboard and I've been crackin away at this strategy for the past 12 hours. At my wits end I've redone the script using tried and true functions from other successful strategies (eg. The Time Parser, etc) and hope someone can help me figure this out. The intent of my strategy is such ->
1. There are 3 moving averages. 1 slow MA, 1 fast MA and 1 Trigger MA (faster still)
2. For a Buy Entry, each of these MA's need to be rising in order of Trigger at the highest, Fast then Slow. From here when the candle open of period-1 ago is beneath the trigger MA, and the same candles close is above it, followed by another bullish candle, the open of the third candle is the trigger to go long.
3. Bearish Entry works in reverse. And now the problem sending me homicidal....
I want this strategy to only take and manage one trade at a time. With the bullish trade, it is to be exited completely with no further trades when price action closes back beneath the trigger MA. I just cannot get the script to work and when I could it would conduct the trades but would not exit them. The source code is attached and I'd greatly appreciate not just any help, but a little guidance as to how to best manage exiting trades completely that way, as a lot of what i see are just trades that exit and reverse in another direction (ie. moving avg cross trades....)