Reply

‘Exit after bars’ in profit/loss

12 replies

Threshold

Customer, bbp_participant, community, 715 replies.

Visit profile

5 years ago #114392

Current ‘Exit after bars’ simply exits after X bars from entry.

Is it possible to ‘exit after bars’ in profit/loss?

If 10 consecutive bars in loss then exit.

If 20 Consecitive bars in profit then exit.

Possible currently or in new EA Wizard.

Also would like to see “Exit @ end of day” added to new EA Wizard.

0

Patrick

Customer, bbp_participant, community, 424 replies.

Visit profile

5 years ago #133771

Hi Treshold,

and what is the logic of it? Patrick

0

RJL

Customer, bbp_participant, community, 70 replies.

Visit profile

5 years ago #133772

Nice one, Threshold. I’m also wanting something like this to better control exits.

 

I noticed your equity growth curve shot up today on the back of NFP’s…good job!

 

My equity growth curve has also had moments significantly above actual growth but I’m thinking I need to diversify my portfolio further to incorporate strategies that take profits quicker to supplement the swing and longer term trade strategies, as I just don’t seem to be realising profit before equity growth falls back down again.

 

It can be a little frustrating watching the portfolio cut off the losers early in the hope that the winners run longer, but then for the winners to regress a little…hopefully before running even further in to profits (but obviously the frustration is when that doesn’t happen).

0

Threshold

Customer, bbp_participant, community, 715 replies.

Visit profile

5 years ago #133773

I’m going to do a thread on my automated portfolio in coming months, maybe when SQ4 is released. It only has a few strategies in it, and nothing has been added to it since last March when it started. In fact 1 strategy was removed that I ran through a Walk Forward and some others tests and determined it shouldn’t have gone live at all but I forced it in. It contributed a good amount to the drawdown.
I have about 12 really good EA Wizard strategies waiting to be added that require portfolio-level optimization (they trade multiple pairs using the same rules and settings) from SQ4 that will really boost its trade frequency and profitability. I’ve stayed away from making anything in SQ for much of the last half year because it doesn’t have symmetric optimization for most of the parameters.
The strategies in the portfolio right now are mostly D1  based(EA Wizard) and only trade a few high percentage breakouts per year. The 2 otheres are SQ strategies on EURUSD that are trend following in nature (lots of losses but really big occasional wins) that I’ve been using successfully before the public portfolio was even created.
I am hoping a beta of SQ4 comes around the New Year/January so I can get all these other strategies into the public portfolio and get its trade frequency up & $.

On the NFP: Yes, D1 based strategies tend to greatly benefit from volailile events, whereas strategies trading on small timeframes get destroyed by them, unless you have a really, really good broker with deep liquidity.

0

RJL

Customer, bbp_participant, community, 70 replies.

Visit profile

5 years ago #134550

Not sure if you have managed to figure this out yet, but here is a possible solution for you…

 

Rather than using ‘Exit after bars’ you can setup a new rule to do the following:

 

Under strategy control, use

 

‘Bars Since Order Open’ for Magic Number X  greater than/less than/equal to Number of bars [ x ]

 

AND

 

Open P/L (either pips or money) is greater than/less than X Profit/Loss

 

THEN

 

Close position Magic Number X

 

Etc…for however many number of orders you have setup.

 

Hope that helps.

 

Also, I’ve posed my own question for a problem I’m having here: https://strategyquant.com/forum/topic/4050-delete-pending-orders-if-initial-order-is-closed-or/in case you’re encountered this problem yourself.

 

Thanks in advance.

0

Threshold

Customer, bbp_participant, community, 715 replies.

Visit profile

5 years ago #138306

Ok now I know the solution thanks you Tomas in my other thread.
Create a “counter” and an optimizer.

Variable = BarsProfitLongCounter = 0
Variable = BarsProfitOpt = 5 //This one gets optimized
System exits after 5 consecutive bars in profit.

Rule Long Counter
If OrderPosition is Long
and Close[1 ] > OrderEntryPrice    //Meaning last bar was in profit

Then
Assign Variable
BarsProfitLongCounter = (BarsProfitLongCounter+1)

Rule Long Exit
If OrderPosition is Long
and BarsProfitLongCounter = BarsProfitOpt

Then
Exit long

Rule LongCounter Reset
If OrderPosition is long
and Close[1] < OrderEntryPrice

Then
Assign Variable
BarsProfitLongCounter = 0  //If any bar closes not in profit, reset the counter.

-This “Counter” variable can be used in so many dif ways such as counting consecutive days above MA, consecutive times ADX has risen/fallen or consecutive days RSI overbought/oversold as just a couple examples. Its quite powerful.
 

0

tomas262

Administrator, sq-ultimate, 678 replies.

Visit profile

5 years ago #138349

Yes, at the first look EA Wizard seems to be pretty limited but then you start to play with variables and various condition – almost anything can be achieved. When combined with SQ this will be powerful. Looking forward to it personally 🙂

0

DM00

Subscriber, bbp_participant, community, 11 replies.

Visit profile

4 years ago #138910

Thank you very much. I don’t know if I’ll understand the example as I’m a newbie and clueless in programming, but ill try. 

 

Dean

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

4 years ago #138987

hi Tomas,

 

I configured Threshold’s conditions (with and without IsBarOpen) and ran them on MT4 backtests, all do not close at 5th bar on profit (likely same for losses).  

 

Did I miss out something? 

 

 

 

=====================

 

Thank you Threshold for sharing the concept/idea… 🙂 

0

tomas262

Administrator, sq-ultimate, 678 replies.

Visit profile

4 years ago #139001

Hello,

 

you have to use “evaluate on bar open only” or isBarOpen because you need the counter work to count only when a bar switches to next bar. I have modified your project. It now trades for me

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

4 years ago #139005

hi Tomas,

 

Thank you.

 

Btw, when comes to Multiple Time Frame(MTF) back testing, does MT4 backtest do MTF testing well?

0

tomas262

Administrator, sq-ultimate, 678 replies.

Visit profile

4 years ago #139034

Hello,

 

some guys reported it is not possible in MT4. I have tried some sample EA Wizard rules and it was working so probably depends on EA complexity

0

Threshold

Customer, bbp_participant, community, 715 replies.

Visit profile

4 years ago #139041

Multi TF testing works. You need to run the test on the lowest TF the system is referencing. EA Wiz code will calculate the higher TF price/indicator points from there.

0

Viewing 13 posts - 1 through 13 (of 13 total)