BykovTrend Signal MT4 Indicator

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

BykovTrend Signal MT4 Indicator

Postby bjmerkel » Fri May 21, 2010 8:35 pm

Hello,

Can you convert this into a .lua file? Thanks.

http://forexarena.blogspot.com/2009/09/ ... cator.html
bjmerkel
 
Posts: 24
Joined: Wed Apr 21, 2010 2:50 pm

Re: BykovTrend Signal MT4 Indicator

Postby Nikolay.Gekht » Sun May 23, 2010 3:19 pm

I've added the requests for all your post to the dev. queue. It will take some time to implement them all. :-)
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: BykovTrend Signal MT4 Indicator

Postby bjmerkel » Sun May 23, 2010 5:11 pm

Thanks for that. I am sure you get this question all the time but I have some experience in programming and I was wondering if you can recommend any information or programs that I can use to educate myself on converting .mq4 to .lua? So instead of asking you to do all the hard work I can do some of it myself. Thank you very much.

Brad
bjmerkel
 
Posts: 24
Joined: Wed Apr 21, 2010 2:50 pm

Re: BykovTrend Signal MT4 Indicator

Postby Nikolay.Gekht » Sun May 23, 2010 9:47 pm

Any new indicator developer is truly welcome here. To start the development you have to:

1) Read about the lua programming language. This is the classic procedure-oriented programming language looking like the pascal family languages. The semi-object-oriented extension is so called "tables". The "static" methods of the table is called via "." operator, for example math.abs(x), the "instance" methods are called via ":" operator, for example source:size().

The language has no typing and even no explicit variable declaration, but we recommend to declare variable for better control over the scope.

The main site about lua is http://www.lua.org. However, the lua documentation is also included into the Indicore SDK documentation.

2) Download and install the SDK. http://fxcodebase.com/documents/indicor ... oreSDK.exe

The SDK is not required, but contains:
- the local setup of the documentation (however you can always use online documentation on this side).
- the simple syntax-highlighting editor (but you can use any preferable syntax highlighting editor).
- the simple debugger for the indicators and strategies (this could be useful because unlike running under Marketscope it lets you control over the execution flow (all these breakpoints, watch expressions and so on)). Unfortunately, the debugger shows the numbers only, it does not draw anything. So, to see how does it look you have to use the Marketscope application.

Read the SDK documentation. In additional to the lua documentation it also includes the description of the Marketscope indicators and signals' object models and a number of articles about indicator programming concepts.

And, yes, you are welcome with any questions, regarding lua or the indicator development on the development forum: viewforum.php?f=28

Also, a few words about translation of MT4 to Marketscope. The indicator models are very close.

In MT4 you declares indicator parameters and buffers as the global variables of the indicator.
In Marketscope you declares indicator parameters inside the Init function and buffers inside the Prepare function. This gives you richer control over parameters and buffers. For example you can group parameters, you can provide choices for the parameters and you can even group your outputs into the "true" candles.

As for MT4 there is function to calculate the values. In MT4 it's start function, in Marketscope it's Update function. As for MT4 the prices and the indicator results are kept in the buffers. Unlike MT4 where the buffers are arrays, in the Marketscope is variable-length vectors, but the idea is exactly the same - if you want to show indicator value for the period (bar) N - just put the value into Nth element of the output buffer.

There are two serious distinction between Marketscope and MT4 indicator model:

1) In MT4 the buffers are indexed from size - 1 (the oldest data) to 0 (the most recent data), i.e. in the reverse order. In Marketscope buffers are indexed from 0 (the oldest data) to size - 1 (the most recent data).

2) In the MT4 is indicator function start() is called once to recalculate the indicator and the indicator is fully responsible to calculate only those bars which must be recalculated. In the marketscope Update function is called for each new bar individually, so, in your algorithm you are usually care about calculation of the value for one bar only.

You can start with this step-by-step instruction of creating a new indicator on GMMA example:
viewtopic.php?f=28&t=411
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: BykovTrend Signal MT4 Indicator

Postby Alexander.Gettinger » Mon May 24, 2010 10:53 am

Nikolay.Gekht wrote:I've added the requests for all your post to the dev. queue. It will take some time to implement them all. :-)


I take this problem from queue.
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: BykovTrend Signal MT4 Indicator

Postby Alexander.Gettinger » Mon May 24, 2010 12:03 pm

Indicator Williams Percent Range (viewtopic.php?f=17&t=898) must be also installed.

BykovTrend.png


Code: Select all
function Init()
    indicator:name("BykovTrend");
    indicator:description("BykovTrend")
    indicator:requiredSource(core.Bar);
    indicator:type(core.Indicator);
   
    indicator.parameters:addInteger("RISK", "RISK", "", 3);
    indicator.parameters:addInteger("SSP", "SSP", "", 9);
   
    indicator.parameters:addColor("UpC", "Up color", "", core.rgb(255, 0, 0));
    indicator.parameters:addColor("DownC", "Down color", "", core.rgb(0, 255, 0));
end

local source=nil;
local UP=nil;
local DN=nil;
local RISK;
local SSP;
local first;
local wpr;
local uptrend=nil;
local old=nil;


function Prepare()
    source = instance.source;
    local name = profile:id();
    RISK = instance.parameters.RISK;
    SSP = instance.parameters.SSP;
    wpr = core.indicators:create("WILLIAMSPERCENTRANGE", source, SSP);
    first = wpr.DATA:first()+SSP;
    instance:name(name);
    UP = instance:createTextOutput ("Up", "Up", "Wingdings", 10, core.H_Center, core.V_Top, instance.parameters.UpC, first);
    DN = instance:createTextOutput ("Dn", "Dn", "Wingdings", 10, core.H_Center, core.V_Bottom, instance.parameters.DownC, first);
end

function Update(period, mode)
    if (period > first) then
     wpr:update(mode);
     local K=33-RISK;
     if wpr.DATA[period]<-100+K then
      uptrend=false;
     end
     if wpr.DATA[period]>-K then
      uptrend=true;
     end
     if uptrend~=old and uptrend==true then
      UP:set(period, source.low[period]-30*source:pipSize(), "\225", "Classic bullish");
     end
     if uptrend~=old and uptrend==false then
      DN:set(period, source.high[period]+30*source:pipSize(), "\226", "Classic bullish");
     end
     old=uptrend;
    end
end
Attachments
BykovTrend.lua
(1.7 KiB) Downloaded 797 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: BykovTrend Signal MT4 Indicator

Postby Hybrid » Thu Jun 03, 2010 12:14 pm

Hi,

This is a very practical Indicator, thank you.

I have the following question:
Is it possible to play with the coding and create a new version, where it doesn't signal so often, but showes only the significant changes? (The signals within a trend are misleading)
I have tried to achieve that by changing the values in the parameters, but it did not work well.

Thanks.
Hybrid
 
Posts: 42
Joined: Fri Apr 02, 2010 7:52 am


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 32 guests