Go Back   DailyFX Forex Forum | FX Forum > FXCM Products and Services > FXProgrammers > Discussion / Support Forum > Indicator SDK Support

Reply
 
Thread Tools Rate Thread
  #1 (permalink)  
Old 05-15-2009, 07:08 AM
Member
 
Join Date: May 2009
Posts: 6
reginad is an unknown quantity at this point
Exclamation PROBLEM WITH PROGRAMMING NEW INDICATORS FOR MARKETSCOPE USING LUA LANGUAGE

I would appreciate the assistance of anyone that can help me setup INTRADAY PIVOTS, SUPPORT (S1, S2) and RESISTANCE (R1, R2) in marketscope charting system using LUA Language.

The problem I’m having is that I could not find the code for DAILY TIME PERIODS in Marketscope and LUA. The default periods code is ‘bars’ i.e. 5minute, 1minute etc. Here is my code that I tried for the PIVOT INDICATOR:



function Init()
indicator:name(resources:get("name"));
indicator:description(resources:get("description") );
indicator:requiredSource(core.Bar);
indicator:type(core.Indicator);

indicator.parameters:addInteger("n", resources:get("param_n_name"), resources:get("param_n_description"), 0);
indicator.parameters:addColor("pp_color", resources:get("param_pp_color_name"), resources:get("param_pp_color_description"), core.rgb(255, 0, 0));
end

-- Indicator instance initialization routine
-- Processes indicator parameters and creates output streams
-- TODO: Refine the first period calculation for each of the output streams.
-- TODO: Calculate all constants, create instances all subsequent indicators and load all required libraries

-- Parameters block
-- initialization of variables
local n;
local first;
local source = nil;
local rdg = 0;
-- Streams block
local pp = nil;

-- Routine
-- initialization of instance of indicator
function Prepare()
n = instance.parameters.n;
source = instance.source;
rdg = 0;
first = source:first();

local name = profile:id() .. "(" .. source:name() .. ", " .. n .. ")";
instance:name(name);
pp = instance:addStream("pp", core.Line, name, "pp", instance.parameters.pp_color, first);
end

-- Indicator calculation routine
-- TODO: Add your code for calculation output values
-- output will be seen on pp
function Update(period)
if period >= first and source:hasData(period) then
rdg = (source.high[period] + source.low[period] + source.close[period]) / 3;
pp[period] = rdg;
end
end
Reply With Quote
  #2 (permalink)  
Old 05-15-2009, 07:49 AM
Member
 
Join Date: Apr 2009
Posts: 36
gidien is an unknown quantity at this point
HI,

i also tried to code a automated PIVOT, but i think that is not possible.

You can try this PIVOT indicator as well, but you must put the daily high close open manually. You will find it in the parameter dialog.
Attached Files
File Type: zip PIVOT.zip (1.9 KB, 66 views)
Reply With Quote
  #3 (permalink)  
Old 05-15-2009, 01:26 PM
Member
 
Join Date: Nov 2008
Posts: 37
FxTopor is on a distinguished road
One guy already automated pivots:
Bearishtrader's E-Mini Day Trading (B)log: April 6, 2009 FXCM Trading Station II(TM) Pivots Indicator

Also there are a couple of another indicators on:
fxlua
Reply With Quote
  #4 (permalink)  
Old 05-15-2009, 02:18 PM
Member
 
Join Date: Apr 2009
Posts: 36
gidien is an unknown quantity at this point
That is the indicator i attached. This is not fully automated. You have to put the high low close values every day to the indicator manually.
Reply With Quote
  #5 (permalink)  
Old 05-15-2009, 03:05 PM
Member
 
Join Date: Oct 2008
Posts: 530
Nikolay.Gekht is on a distinguished road
An ability to get additional data for the indicator (currently only the chart at which the indicator is applied is available) is currently being discussed for the next version of the SDK.
Reply With Quote
  #6 (permalink)  
Old 05-18-2009, 07:59 AM
Member
 
Join Date: May 2009
Posts: 6
reginad is an unknown quantity at this point
Smile a lot of thanks

Thank you very much! I am trying it now in MarketScope. Thank you!
Reply With Quote
  #7 (permalink)  
Old 05-18-2009, 08:00 AM
Member
 
Join Date: Apr 2009
Posts: 36
gidien is an unknown quantity at this point
Automated PIVOT Levels

Hi at all,


i finsihed the code for a automated PIVOT Level Indicator.

The indicator gets the daily PIVOT Level.

How to use is Indicator??

Well you have to parameters to set.

1. Period
2. Stunden (is german for hour)

1. the period depents on the Timeframe of the chart u use.

Chart M1:
period is 1440
Chart M5:
period is 288
Chart M15:
period is 96
Chart M30:
period is 48
Chart 1h:
period is 24

2. Stunden(hour)

here u set at which clock the pivot is calculatet new.

If "Stunden" is 6 then the PIVOT will be calculate new at 06:00 a clock.

So check it out.
Attached Thumbnails
problem-programming-new-indicators-marketscope-using-lua-language-pivot.jpg  

Attached Files
File Type: zip PIVOT.zip (1.9 KB, 88 views)
Reply With Quote
  #8 (permalink)  
Old 05-18-2009, 08:19 AM
Member
 
Join Date: Apr 2009
Posts: 36
gidien is an unknown quantity at this point
Sorry period calculation was wrong:

use

Chart M1:
period is 1440 +32
Chart M5:
period is 288 +16
Chart M15:
period is 96 +8
Chart M30:
period is 48 + 4
Chart 1h:
period is 24 + 2
Reply With Quote
  #9 (permalink)  
Old 05-18-2009, 02:12 PM
Member
 
Join Date: Apr 2009
Posts: 36
gidien is an unknown quantity at this point
i copied the code for the full automatic PIVOT Level indi to you other thread

FIBONACCI PIVOTS FORMULA
Reply With Quote
  #10 (permalink)  
Old 05-18-2009, 10:21 PM
Member
 
Join Date: May 2009
Posts: 6
reginad is an unknown quantity at this point
Smile thanks again

hi gidien! Thank you very much!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.

All times are GMT -5. The time now is 12:18 PM.
Copyright ©2009 Daily FX. All Rights Reserved.