Reply

Adding new candle pattern block

6 replies

Timo

Customer, bbp_participant, community, 0 replies.

Visit profile

4 years ago #247385

Hi

 

I’d like to add new version Of the engulfing cande pattern blocks to SQX. I find the BearishEngulfing.java file and, I guess, I can make clone of that one for my modification. Something tells me that it’s not quite that easy. Maybe there is other files else where that needs to be created? Maybe something for the pseudo code? Maybe comething for MQL code itself? The examples of extending SQ looked a bit different cases.

Any help would be appreciated

Timo

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

4 years ago #247424

Hello,

we have a step-by-step guide on how to add a new indicator you can follow the same steps with your candle pattern https://strategyquant.com/codebase/adding-envelopes-indicator-step-by-step/

0

Timo

Customer, bbp_participant, community, 0 replies.

Visit profile

4 years ago #247632

Hi

I cloned the bearishEngulfing snippet and it’s *.tpl files. Modified the .java And the new candle pattern works in SQX backtesting. When I try to export it to mt5 format it complains that it cannot find such a new function.

I didn’t quite understand from the above example how I would do the .mql code block of my candle patter to presumably .tpl file? It’s a bit confusing since I guess the standard bearishEngulfing pattern is hard coded in sq and thus the mt4 code block is not seen in any files?

If you could give an example of adding bearish engulfing pattern code in .tpl format. Or did I miss something here?

cheers

Timo

 

 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

4 years ago #247693

If you look into Editor -> Code -> MetaTrader 4 -> Blocks you can see the existing BearishEngulfing.tpl template file. It will be the same template for your candle pattern I guess so if you already created the template file for your new snippet make sure the content is the same

0

Timo

Customer, bbp_participant, community, 0 replies.

Visit profile

4 years ago #248250

In short when I try to compile the mql file, it doesn’t find the function of my candle block. It makes the function call in mql code, but the function body is missing. I don’t undertand how the funtion body code is generated in mql language. My new candle block works in SQX fine, but when I try to export it to the mql the function body is missing. And I don’t understand how to handle it by looking the BearishEngulfing block as a example.

I used the brearishEngulfing as my example to extend my version, so I try to make everything the same. In bearishEngulfing the mql template file body is:

sqBearishEngulfing(<@printInput block />, <@printShift block shift />)

I don’t know why the function now is called sqBearishEngulfing instead of just BearishEngulfing, or does it matter? Neverthe less I don’t see any mql code in .tpl file itself, so where the mql code comes from? Is it copied/translated from SQ block .java file?

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

4 years ago #248302

the template *.tpl file cotains only a call of the function to recognize candle pattern. The function (sqBearishEngulfing in this case) is itself defined in file SQ.mqh in the main language folder (MetaTrader4 or 5).

The easiest thing to do is to create your own funciton in this file, and then call it from the *.tpl file.

The only problem is that file SQ.mqh will be overwritten in the new update.

We will add support forcustom funcitons definitions for MT4/MT5 code generation.

Mark
StrategyQuant architect

0

Timo

Customer, bbp_participant, community, 0 replies.

Visit profile

4 years ago #248370

Thank you Mark – makes sense now

I probably try to customize the SQ.mqh file for now as you suggested.

Timo

0

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