Belkhayate's Center Of Gravity

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Belkhayate's Center Of Gravity

Postby Nikolay.Gekht » Mon Apr 19, 2010 8:26 pm

The indicator can be used to detect the direction of the trade. Looks, for example the following trade system for details.


Download the indicator:
(6.28 KiB) Downloaded 10676 times

See also the bigger time frame version


Finite Belkhayates center of gravity can be located anywhere on chart.
Finite Belkhayates Center Of Gravity.lua
(10.49 KiB) Downloaded 4356 times

MT4/MQ4 version.
FXCodeBase: Site Admin
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Belkhayate's Center Of Gravity

Postby barishn » Sun May 02, 2010 11:02 pm


Thanks so much for this indicator, it works really well, my only query is how come it doesn't load for the entire length of a seems to only show for a short time it suppose to be that way?

Thanks :)
Posts: 1
Joined: Sun May 02, 2010 10:58 pm

Re: Belkhayate's Center Of Gravity

Postby Nikolay.Gekht » Mon May 03, 2010 7:57 am

Yes. The indicator is drawn for the last N (where N is the first parameter of the indicator) bars only. Moreover, the indicator completely redraws all last N bars when a new bar appears.
FXCodeBase: Site Admin
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Bigger time frame version

Postby Nikolay.Gekht » Wed May 05, 2010 2:37 pm

The bigger time frame version of the indicator:


(7.09 KiB) Downloaded 6179 times

(the BELCOG.lua must be also installed!)
FXCodeBase: Site Admin
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Belkhayate's Center Of Gravity

Postby aarons_alive » Wed May 05, 2010 7:41 pm

Ahhhh yes. A 'selling into strength' system... just what my bank account needs!
Posts: 13
Joined: Mon Apr 19, 2010 10:50 am

Re: Belkhayate's Center Of Gravity

Postby jefftrader » Tue Jul 13, 2010 4:20 pm

any possibility of getting a version of this indicator that doesn't repaint on every new bar?
Posts: 28
Joined: Tue Jul 13, 2010 4:13 pm

Re: Belkhayate's Center Of Gravity

Postby Nikolay.Gekht » Tue Jul 13, 2010 10:02 pm

No, because such class of the indicator (the same is, for example for any approximation indicators or to the wave analysis) always does it. It is specific of the method.
FXCodeBase: Site Admin
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Belkhayate's Center Of Gravity

Postby Poupouille » Wed Nov 09, 2011 4:54 pm

Hello. I search the indicator "Belkhayate Timer" (and not Belkhayate Timing) with Marketscope 2.0 from FXCM ! Can you help me ?
Posts: 18
Joined: Fri Feb 04, 2011 8:19 am

Re: Belkhayate's Center Of Gravity

Postby Apprentice » Wed Nov 09, 2011 5:53 pm

Can you provide me code for this indicator or a web reference.
User avatar
FXCodeBase: Confirmed User
Posts: 36946
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Belkhayate's Center Of Gravity

Postby Karlo_Karlo » Mon Feb 27, 2012 3:33 pm

This indicator seems to work quite well. I tried to make a signal but my knowledge is not enough for this task. Here is the code which does not work correctly. It generates signals but not in the right places. Signals must be generated when price touches L3 (L4) or L6 (L7).

Dear Nikolay, maybe you can help?

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);

-- Indicator instance initialization routine
-- Processes indicator parameters and creates output streams
-- Parameters block
local gSource;
local BELCOG;

local SoundFile;
local RecurrentSound;
local Email;
local ShowAlert;
local name;

local N;
local O;
local E;

-- Streams block
local L1;
local L2;
local L3;
local L4;
local L5;
local L6;
local L7;

-- 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
        return ;

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

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


function ExtUpdate(id, source, period)
    if id == 1 then

        if period >= BELCOG.DATA:first() + 1 then
            local message = nil;

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

            if message ~= nil then
               if ShowAlert then
                   terminal:alertMessage(,[NOW], message,;

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

               if Email ~= nil then
                   terminal:alertEmail(Email, name, name .. "(" .. core.formatDate( .. ") : " .. message);

dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");
Last edited by Karlo_Karlo on Tue Feb 28, 2012 4:29 am, edited 1 time in total.
Posts: 11
Joined: Fri Jan 07, 2011 4:48 am


Return to Custom Indicators

Who is online

Users browsing this forum: No registered users and 25 guests