Reply

MACD Open at Next Bar

7 replies

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #113395

Need help. I have tried multiple times to modify the EA but can’t seem to get this one strategy rule working. Their are other I add to it but just to get the trade to trigger on this one rule I can’t seem to get it.

 

Rule:

    If MACD (12,26,9) Histogram is greater than 0 and also MACD (12,26,9) signal line is greater than 0 AND

    MACD (12,26,9) Histogram has been greater than MACD (12,26,9) line for a minimum of 4 candles back AND

    MACD (12,26,9) Histogram has closed finally below the signal line then initiate a short on next bar open. Below is the latest rule I have but don’t know where im going wrong.

 

EA Wizard:

 

market position is flat

MACD(12,26,9, close, Main)[1]>0

MACD(12,26,9, close, Main)[4]>MACD(12,26,9,close,signal)[4]

MACD(12,26,9,close,Main)[3]>MACD(12,26,9,close,signal)[3]

MACD(12,26,9,close,main)[2]>MACD(12,26,9,close,signal)[2]

MACD(12,26,9,close,main)[1]<MACD(12,26,9,close,signal)[1] (this one is less than to signal the one bar back below histogram)??

OrderOpenedThisBar(MagicShort)isTrue

 

THEN: Enter at Market

 

WHAT AM I DOING WRONG WITH THIS STRATEGY, ITS NOT OPENING A POSITION AT NEW BAR

 

I have also attached strategy if anyone can edit or explain problem. Thanks

 

   

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #129127

please attach the strategy again, it is not here.

 

I don’t see anything wrong in MACD conditions, but what is the OrderOpenedThisBar(MagicShort) doing?

Isn’t that the reason why it doesn’t work?

Mark
StrategyQuant architect

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129157

Mark,

  I have attached the strategy. Also I am trying to only use 1 trade per candle but its not working either. Could you please look at it and edit it or let me know what I am doing wrong. Your help in editing would be greatly appreciated as I have been trying to get this 1 trade per candle under control but I just can’t seem to get it right.

 

I have also attached a 2nd file just with trades per candle just for testing as well and its not working. I tried building per the forums I read and also my and your direct communication and its still trading multiple times per candle.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #129166

Hello,

 

I checked the strategy, there were several problems:

1. in your first rule you use OR but don’t use any brackets

 

2. you use Bid crosses below EMA, do you really mean that?

 

3. in your description you specified:

MACD(12,26,9,close,Main)[3]>MACD(12,26,9,close,signal)[3]

but in the strategy I see:

MACD(12,26,9,close,Main)[3]>MACD(12,26,9,close,Main)[2]

 

so, I;m not sure which one you want to use.

 

 

Your strategy doesn’t open any trades in my backtest, because the trade rules are never true.

This means that you specified a combination of conditions that are never true.

 

It is difficult to find out which condition causes this exactly. The easiest thing to do is to start with very simple strategy and just one condition, and make sure it takes some trades.

Then add more conditions and always backtest it to make sure it does what you wanted.

 

I’m sending a corrected strategy, but it still doesn’t take trades for me.

Mark
StrategyQuant architect

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129180

Ok, I think I can work out more of the rules once I get the trades per candle issue down.

 

But once again, I can’t get the only 1 trade per candle thing down. The attached strategy is a very simple:

 

Go short when:

EMA(10) < EMA(20)

 

GO long when:

EMA(10) > EMA(20)

 

But when its trading it will do multiple positions per candle, How to fix this? I also want it to where if I want 2 trades per candle I just input it in their as well and they will start doing 2 trades per candle.. Can you please see whats wrong and where I am messing up?

 

 

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129196

Mark,

  Any luck at getting a chance to look at this for me about trade per candle issue?

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

9 years ago #129220

Mark,

 

  Anything? I have wasted hours upon hours trying to get this but can’t figure it out, now I have disabled all my EA’s and stuck in limbo and just don’t know what to do. I would pay in order for you to phone conference me in order to get this issue fixed for me b/c as of now I am sitting dead in the water with no EA’s running b/c I can’t get them to trade only once per candle.

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #129262

as I replied to you in another thread, you don’t have logic that would prevent EA opening multiple trades per candle.

The easiest solution is to add IsBarOpen=true condition to your first rule. This will ensure that trend is set to 1 only once when the candle is opened.

 

When EA opens trade it sets trend=0 and it will remain like that until the next candle.

Mark
StrategyQuant architect

0

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