Page 2 of 4

Re: Belkhayate's Center Of Gravity

PostPosted: Mon Feb 27, 2012 6:18 pm
by Hug Coder
See if this works. I haven't tested it.

Code: Select all
    -- Indicator profile initialization routine
    -- Defines indicator profile properties and indicator parameters
    function Init()
    strategy:name("Gravity signal");
    strategy:description("Signals when Price hits Gravity Edges");

    strategy.parameters:addGroup("Gravity parameters");
    strategy.parameters:addInteger("N", "Number of bars", "", 120);
    strategy.parameters:addInteger("O", "Order", "", 3);
    strategy.parameters:addDouble("E", "Eccart value", "", 1.61803399);

    strategy.parameters:addGroup("Price parameters");
    strategy.parameters:addString("Period", "Time frame", "", "m1");
    strategy.parameters:setFlag("Period", core.FLAG_PERIODS);

    strategy.parameters:addGroup("Signal parameters");
    strategy.parameters:addBoolean("ShowAlert", "Show Alert", "", true);
    strategy.parameters:addBoolean("PlaySound", "Play Sound", "", false);
    strategy.parameters:addFile("SoundFile", "Sound file", "", "");
    strategy.parameters:setFlag("SoundFile", core.FLAG_SOUND);
    strategy.parameters:addBoolean("Recurrent", "RecurrentSound", "", false);

    strategy.parameters:addGroup("Email Parameters");
    strategy.parameters:addBoolean("SendEmail", "Send email", "", false);
    strategy.parameters:addString("Email", "Email address", "", "");
    strategy.parameters:setFlag("Email", core.FLAG_EMAIL);

    -- Streams/Indicators
    local gSource, gTick;
    local BELCOG;
    local name;

    -- Parameters
    local SoundFile;
    local RecurrentSound;
    local Email;
    local ShowAlert;

    local N;
    local O;
    local E;

    -- Variables

    -- Init Routine
    function Prepare(onlyName)

       N = instance.parameters.N;
       O = instance.parameters.O;
       E = instance.parameters.E;

       ShowAlert = instance.parameters.ShowAlert;
       if instance.parameters.PlaySound then
       SoundFile = instance.parameters.SoundFile;
       SoundFile = nil;

       assert(not(PlaySound) or (PlaySound and SoundFile ~= ""), "Sound file must be specified");

       RecurrentSound = instance.parameters.Recurrent;
       local SendEmail = instance.parameters.SendEmail;
       if SendEmail then
       Email = instance.parameters.Email;
       Email = nil;
       assert(not(SendEmail) or (SendEmail and Email ~= ""), "Email address must be specified");

       name = profile:id() .. "(" .. .. "," .. N .. "," .. O .. "," .. E .. ")";

       if onlyName then

       assert(instance.parameters.Period ~= "t1", "Can't be applied on ticks!");

       gSource = ExtSubscribe(1, nil, instance.parameters.Period, true, "bar");
       gTick = ExtSubscribe(2, nil, "t1", true, "close");
       BELCOG = core.indicators:create("BELCOG", gSource, N, O, E);


    -- Process data routine
    function ExtUpdate(id, source, period)

       -- If ticksource, use bar period
       if id == 2 then
          period = gSource:size() - 1;
       if period < BELCOG.DATA:first() + 1 then

       if core.crossesOver(gSource.high, BELCOG.L3, period) then
          Signal("Gravity OverBought");
       elseif core.crossesUnder(gSource.low, BELCOG.L6, period) then
          Signal("Gravity OverSold");


    function Signal(Label)
        if ShowAlert then
            terminal:alertMessage(,[NOW],  Label,;

        if SoundFile ~= nil then
            terminal:alertSound(SoundFile, RecurrentSound);

        if Email ~= nil then
            terminal:alertEmail(Email, Label, profile:id() .. "(" .. .. ")" ..[NOW]..", " .. Label..", " ..;

    dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");

Re: Belkhayate's Center Of Gravity

PostPosted: Tue Feb 28, 2012 5:49 pm
by virgilio
Hello developer(s), this is truly a nice treat. There is also another indicator that should be used with this Center of Gravity. It is a timing indicator that reinforces the Center of Gravity's entry and exit points. It can be viewed at the bottom of page 2 in the attached pdf document (Hot to use Belkhayate). The indicator is is called Belkhayate Timing. Is this something you would you be able to replicate and offer in conjunction with the Center of Gravity?
If so, then we have a formidable tool to use.
Thank you!

Re: Belkhayate's Center Of Gravity

PostPosted: Wed Feb 29, 2012 4:35 am
by Hug Coder
This viewtopic.php?f=17&t=715 ?

Re: Belkhayate's Center Of Gravity

PostPosted: Thu Mar 01, 2012 6:56 am
by Karlo_Karlo
Thank you gentlemen, but it looks no different than it was before.
There is the MBFX Timing Indicator subject also; MT4 version gives a color line while the lua version gives something very different, which I do not understand how to use. I understand that it's a subject of intellectual property but it very much looks like that the MT4 Timing Indicator is a colorized version of some common indicator. I tried to look for but did not succeed.
What do you think about it?

Re: Belkhayate's Center Of Gravity

PostPosted: Fri Mar 02, 2012 7:27 am
by Hug Coder
You have to define what you want exactly otherwise it's not so easy.

If you are requesting another indicator please make a proper request in the request forum, with enough information to make something out of it, e.g. a link or code (and picture+description) of the MT4 version.

Re: Belkhayate's Center Of Gravity

PostPosted: Sat Mar 03, 2012 8:49 am
by Karlo_Karlo
Thank you Hug Coder,
Below is the "MBFX Timing.ex4" file, which is the additional indicator for MBFX system. But It is for the MT4 and we do not have a lua version. As it is said in the beginning of this thread that this system is an intellectual property of Mr.Belkhayate and it is not allowed to make a lua version of his indicator without his permission. But I think that this indicator is not a very sophisticated one. I tried to compare it with other common indicators in the MT4 but I could not find anything similar yet. In my recent post I was simply asking your opinion about this indicators resemblance with others.

Re: Belkhayate's Center Of Gravity

PostPosted: Sun Mar 04, 2012 7:50 am
by trendwatch
I've read several statements of mr. Belkhayate wherein he states he is in no way related to MBFX. So the MBFX inidcators are not the same as those mr. Belkhayate uses in his system. Just thought you might like know this before you started using these indicators.

Re: Belkhayate's Center Of Gravity

PostPosted: Tue Mar 06, 2012 5:15 am
by Hug Coder
As I said, if you want another indicator, you shouldn't post requests in this thread. If what you are looking for is a different version of the Belkhayate's Timing Indicator (viewtopic.php?f=17&t=715) then post there, otherwise post a new request thread for what you want, with proper descriptions etc.

The file you posted seems to be a compiled file which has no clear text/code so it's of no use.

Re: Belkhayate's Center Of Gravity

PostPosted: Thu May 31, 2012 8:33 pm
by elliotwave5
a) Can the Belkhayate indicators (BF long term reg and timing indicators) be used publicly? I believe reading that they are proprietary to him exclusively or are they public?
b) currently reviewing an H4 chart and the GBP/USD is way outside the L7 band. am i correct in that this indicates that one should take a long position? how many pips to risk on the stop and what would his limit be on profit taking?
any comments or suggestions would be greatly appreciated

Re: Belkhayate's Center Of Gravity

PostPosted: Fri Jun 01, 2012 3:17 am
by Apprentice
I am not aware of such limitations.
Everything posted here can be used for your own private use.