Reply

One trigger per trend conundrum

15 replies

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

9 years ago #112768

I haven’t managed to find the answer elsewhere in the forum so here goes . . . 

 

I would be keen to know if anyone has thought of a way to limit an ea to taking one trade per “trend”. For example a simple moving average cross plus one other indicator for confirmation. Only take one trade until the ma’s cross again. This would be fine if the trigger is the ma cross but it’s not and if a trade gets closed at profit or loss and the condition remains true it takes additional trades which I do not want.

 

Any thoughts would be much appreciated.

 

 

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #126986

you can do this using variables. Create a variable (parameter) and assign a value1 to it when trend starts.

 

Then reset the variable to 0 when you open new trade and don’t take trades until the variable is set to 1 again.

 

You’ll need an extra rule to check the trend and set the variable.

Mark
StrategyQuant architect

0

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

9 years ago #127001

Excellent – many thanks Mark.

0

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

9 years ago #127010

Hi Mark,
 
Please can you cast your eye over the attached simple example where I have created a variable that changes to “1” if a trend change is detected via a cross of two moving averages. It is then supposed to take a long or short trade and reset the variable to “0” until the next trend change occurs.

 

It does not appear to be working and I’m not sure how to check the variable value or where I am going wrong.

 

Many thanks for any help you can provide.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #127011

I checked your strategy, it looks good, this is how I meant it.

Mark
StrategyQuant architect

0

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

9 years ago #127226

Thanks Mark, yes it does in fact work. What was confusing me was the signal indicator because for some reason that was not displaying the entries. Thanks for the tip, it’s opened up a whole new world !

0

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

9 years ago #127344

Just to clarify the signal indicator is working fine. My error, the markers were plotting in exactly the same space and therefore sitting on top of each other. Duh! Apologies.

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #128755

I have read over this and over this and just cannot get it. I have attached a sample of what I created per the instructions above. Could you please look at it and let me know where I am going wrong. I know their has to be something I am missing or not doing correctly but trying my best. Please let me know.

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #128758

Guys I don’t know what I am doing wrong. I know it is probably something so simple but just can’t get it. I edited the strategy about 4 different ways last night and 2 different ways this morning and just can’t get this thing to trade. This is the last way I can think of to get this to work and its still not trading (see attached). I just don’t know what other options I have to make this work. Someone’s help is greatly appreciated.

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #128768

Does anyone respond anymore? I still am dealing with this problem. I got it to finally trade 1 trade per candle but where do I edit settings in order for it to trade 2 trades per candle? No matter what I do, its only allowing me to trade 1 per candle. Can someone please help as I am wasting a ton of time trying to figure this out and no response back with help.

 

No matter what I edit I can’t seem to get this.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #128797

there are few problems with your strategy:

 

1. you have LotSizeLong and LotSizeShort variables set to 0, so EA tries to open orders with 0 lots, which fails

 

2. Ask/Bid crosses above/below something probably works in other way than you think, ask/bid doesn’t have a history and it shouldn’t be used in crossing conditions.

 

3. missing brackets in your first rule – when you use OR condition you should also specify correct brackets, otherwise default bracketing is used with results you don’t expect.

 

Overall, developing a strategy usually requires also some debugging, why don’t you use functions like Log to Journal or Log to file in your rules to track when your rules really trigger, if they trigger at the times you expect?

And it is always advisable starting with very simple rules and adding on it, it is easier to check what is not working.

Mark
StrategyQuant architect

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129097

1.) Mark I use those Lot sizes so when I load my EA into the chart I can always edit lot size. I leave at 0 for safety purposes b/c it makes me put lot sizes in.

 

2.) What would be in your best opinion to use with crossing strategies like that?

 

3.) What brackets am I missing and got incorrect. I used the same way the guy above did. Could you please explain in detail or edit the strategy I posted above so I can get a better picture of what you talking about? Also I wanted to make sure I had a rule in my Strategy Parameters that once its loaded into my chart on MT4, if I want I have the option of changing to more trades per candle.

 

Ok, so I attached a revised one just to test the theory. So when I add the EA to a chart, then set the settings in input tab, do I change the 0 to whatever number of trades for that bar I want?

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129221

Anything,

  I am a sitting duck here b/c I cannot figure this out. Can someone please clarify and help me of why my trades keep doing multiple at a time.

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129228

Mark,

  I have did exactly what you stated over and over again and this thing is still taking multiple trades. Could someone please advise as of why? I am doing exactly as you say. Attached is the simpliest strategy just like you stated buy it keeps taking more than one trade per candle. I am in a bad spot as I had to disable all my EA’s but I am not getting any response back from you guys in the reason why.. SOMEONE PLEASE ADVISE AND HELP AND LET ME KNOW WHAT I AM DOING WRONG..  ATTACHED IS THE STRATEGY

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #129260

Ryan, you don’t have any logic in your EA that would prevent the strategy to open the trade multiple times in one bar.

 

Solution (one of the possible) is simple – add IsBarOpen check to your first rule where you check for trend.

This will ensure that the trend is checked only in the beginning of bar and if there is a trade in the bar the trend is set to 0 until next bar arrives.

 

I’m attaching the strategy.

 

 

Mark
StrategyQuant architect

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129285

Appreciate that. Where can i get some reading / study material on the “brackets”, “and”, “or” b/c once i start adding more rules i don’t know how the brackets with the “and”, “or” should be laid out in my check trend??

 

Once i add market position is flat to my strategy, does that get put into my check trend as well?

 

Would the same rule of only trading one trade per candle just like you have the strategy above if i change all the ema crosses from [1] back to [0]? That way i don’t have to wait for next candle, the minute it hits the crossit will trigger trade but will it still just give me one trade?

0

Viewing 15 replies - 1 through 15 (of 15 total)