Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › MR BuySetup Differs With Different SellSetup
- This topic is empty.
-
AuthorPosts
-
May 25, 2020 at 3:03 am #102023GlenPeakeParticipant
I’ve been testing a couple of different MRV ideas recently and noticed the following which caught my eye and wanted to confirm if this was expected behaviour? Or is it something unique to me etc.
Short version summary: Depending on my SellSetup exit condition, this impacts my BuySetup targets/arrow(s) seen on the chart.
In addition, modifying the SellSetup will remove/add potential BuySetups on the charts.
So I just wanted to clarify if this was expected or not? As it was something that only recently caught my eye.
Long version summary:
To help illustrate, I’ve taken a copy of the MR CBT Template and modified the Entry and Sell condition(s) to a very basic:
Entry:
Cond2 = C < Ref(C,-1); // Added Sell:
SellSetup = C > Ref(C,-1);(In a nutshell for this I think should be seeing more BUYSETUP arrows). I’ve highlighted in a blue box on the top graph where I think I should see another BUYSETUP arrow, as close < yesterday's close is fairly straight forward entry etc etc).
In the bottom graph, I’ve modified the SELLSETUP line
FROM: //SellSetup = C > Ref(C,-1);
TO: SellSetup = Cross( C, MA(C, 5));Changing the SellSetup removes some of the BuySetup entry arrows. Highlight in the white boxes in the bottom chart.
Is this expected? Does modifying the SellSetup affect whether the BuySetup entry is flagged? Just wanting to confirm expected outcome. (It looks like if the SellSetup is not met, then a BuySetup Entry will not be flagged/triggered.
My trades/backtests work all OK and the trades match OK, it just looks like I should be seeing ‘more’ trade / BuySetups etc.
AFL Files attached…. It’s the MR CBT Template file and just modified/simplified the entry/exit to highlight.
May 25, 2020 at 6:31 am #111494TrentRothallParticipantDo you have this up the top?
SetBarsRequired(sbrAll);
might help?
May 25, 2020 at 7:27 am #111495GlenPeakeParticipantThanks for the suggestion Trent…. unfortunately still no luck.
I already had
SetBarsRequired(sbrAll,0);But then edited to your suggestion, to give that a go….
SetBarsRequired(sbrAll);But no luck….
May 25, 2020 at 9:39 am #111496ScottMcNabParticipantIn the output of trades taken in the backtest, select the stock (VEEV in this case), right click and select “Show arrows for raw signals”
Gotta be honest mate…the system seems a bit of a dog
May 26, 2020 at 1:27 am #111497GlenPeakeParticipantScott McNab wrote:Gotta be honest mate…the system seems a bit of a dog…a dog with fleas…!!!!!
….I just wanted to put some simple BUY/SELL inputs into the code to highlight the issue I was seeing…. as an example etc. Not trading this fleabag ….. Thanks for taking a look, as well as the suggestion.
In the end to address the issue I am seeing, I’ve needed to use code without the looping, which at this point seems to flagging the BUYSETUP entries correctly. More testing required here though….but looks to have improved things
I just need to replace the StaleExit looping code with (i think) “ApplyStop” option. Haven’t used this option previously, so maybe something like the below code, to get me out after X days etc… still need to look into it.
/* N-bar stop */
ApplyStop( stopTypeNBar, stopModeBars, 5 );May 26, 2020 at 4:23 am #111500ScottMcNabParticipantI have seen your results Glen and how impressive they are…I probably should have put an emoticon/emoji at the end of it … Was a weak attempt at humour
May 26, 2020 at 5:15 am #111502GlenPeakeParticipantHahaha…. It was a dog!!! Gotta call a spade a spade All good!
The ApplyStop option for my # Stale Exit Days seems to work nicely as well.
E.g.
/* N-bar stop */
ApplyStop( stopTypeNBar, stopModeBars, 5 );For anyone that hasn’t used it before, the first time I tried to use it, I attempted to ‘activate it’ with my SellSeup criteria….via an ‘OR’ statement, which didn’t work properly, I was seeing max # trade bars of 2 in the backtest.
///////////////////////////////////////////////////////////////////////////////////////////////////////
StaleExitCond = ApplyStop( stopTypeNBar, stopModeBars, 5 );
SellSetup = MyMRVSellOption OR StaleExitCond;
//////////////////////////////////////////////////////////////////////////////////////////////////////I then moved it down to a new line on it’s own….
///////////////////////////////////////////////////////////////////////////////////////////////////
SellSetup = MyMRVSellOption;
Sell = Ref(SellSetup,-1);
ApplyStop( stopTypeNBar, stopModeBars, 5);
///////////////////////////////////////////////////////////////////////////////////////////////////This worked nicely…. still going through the charts, but so far so good.
-
AuthorPosts
- You must be logged in to reply to this topic.