Baluda LibCSS

Includes an archive of all previous Bob stuff
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Baluda LibCSS

Post by Baluda »

Here is my library for all things CSS and derivatives.

August 19, 2013: new version v1.1.3

Changes:
  • Optimized code. Tighter, stronger, faster
  • Fixed bug in caching mechanism

Implementation
Append LibCSS to your EA or indicator, or include it using (drum roll, please) #include.
(Questions about this will be graciously ignored.)

Initialization
Set the following LibCSS paramaters:
  • libCSS.addSundayToMonday - set to 'true' append daily Sunday bars to Monday. Defaults to 'true'.
  • libCSS.useOnlySymbolOnChart - set to 'true' when used on a single symbol EA or indicator. Defaults to 'true'.
  • libCSS.cacheSymbol - set to the name of a preferably high volume symbol which LibCSS will use to cache its css values. Defaults to 'EURUSD'.
  • libCSS.cacheTimeframe - set to the timeframe that LibCSS flushes its cache to. Defaults to 'PERIOD_M1' (Which means all css values are renewed once a minute).
  • libCSS.symbolsToWeigh - Comma delimited list of symbols to use in css' calcluation. Defaults to standard set of symbols.
Initialize LibCSS by calling

Code: Select all

libCSS.init();
anywhere in your init() function.

Constants
libCSS.CURRENCYCOUNT - 8 (Number of currencies)

Variables
string libCSS.currencyNames[]
Array that holds the currencynames.
Sample

Code: Select all

  string myCCY = libCSS.currencyNames[2];
[/size]
Public functions
These are the functions available in LibCSS, use them anywhere in your code.

double libCSS.getCurrencyIndex( string currency )
Returns the index of a currency.

Parameters:
currency - Currency .

double libCSS.getSlope( string symbol, int tf, int shift )
Returns the TMA Slope.

Parameters:
symbol - Symbol.
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.

void libCSS.getCSS( double& css[], int tf, int shift, bool flushCache = false )
Returns the CSS for all currencies in referenced array.

Parameters:
css - Array of doubles.
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.
flushCache - boolean to flush the internal cache.
Use 'flushCache' when multiple timeframes are needed. The internal cache only recognizes one timeframe.
Sample

Code: Select all

   // Initialize
   double myCSS[];
   // Call libary
   libCSS.getCSS( myCSS, PERIOD_H1, shift );
  // myCSS now holds all css's.
   // Call libary, flush cache before any calculation
   libCSS.getCSS( myCSS, PERIOD_H4, shift, true );
[/size]
double libCSS.getCSSCurrency( string currency, int tf, int shift )
Returns the CSS for a single currency.

Parameters:
currency - Currency.
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.
Sample

Code: Select all

  double cssEUR = libCSS.getCSSCurrency( "EUR", PERIOD_H4, 0 );
[/size]
double libCSS.getCSSDiff( string symbol, int tf, int shift )
Returns the difference of the CSS for the currencies in a symbol.

Parameters:
symbol - Symbol.
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.
Sample

Code: Select all

  double diffEURUSD = libCSS.getCSSDiff( "EURUSD", PERIOD_H4, 0 );
[/size]
double libCSS.getSlopeRSI( string symbol, int tf, int shift )
Returns the RSI of the TMA Slope of a symbol. Period length defaults to NB 10.4

Parameters:
symbol - Symbol.
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.

double libCSS.getGlobalMarketTrend( int tf, int shift )
Returns the GlobalMarketTrend, which is the sum of all CSS' squared.

Parameters:
tf - Timeframe. It can be one of the Timeframe enumeration values.
shift - Shift relative to the current bar.


There you have it. Enjoy!


Paul
You do not have the required permissions to view the files attached to this post.
Check the MQL4 Market for my best EA's and Indicators.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Re: Baluda LibCSS

Post by theforexedge »

Paul

Thank you for this... :D

Jason
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Baluda LibCSS

Post by SteveHopwood »

Kind of you to post this, Paul.

I have added Lib.CSS to my shell EA code along with an appreciation of your work, and included a link to here so users can keep up with future developments.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
phil_trade

Re: Baluda LibCSS

Post by phil_trade »

Who is the best ? Paul, for sure ;)

Great job !
User avatar
kwanann
Trader
Posts: 948
Joined: Thu Nov 29, 2012 1:53 am

Re: Baluda LibCSS

Post by kwanann »

Paul,

One quick question, some guys were testing out the lib with NB10.5 Ea and it seems that

if libCSS.useOnlySymbolOnChart is set to true, CSS values calculate properly,but global market trend doesnt.

if libCSS.useOnlySymbolOnChart is set to false, CSS values are wrong but global market trend is correct..

is there anything else i should take note of?
I've been trading using OM Dual N EA for the past 2 years, live results can be found over at https://www.fxblue.com/users/kwanann
User avatar
aSushiRoll
Trader
Posts: 74
Joined: Fri Apr 05, 2013 10:54 pm

Re: Baluda LibCSS

Post by aSushiRoll »

Hi & thanks!

I'm just wondering about this:
void libCSS.getCSS( double& css[], int tf, int shift )
Returns the CSS for all currencies in referenced array.

1) what's the order of the currencies in the array?

2) I know in the other CSS indi's there's a variable called ignoreFuture. What is the setting of this var or the working of this lib in this regard?

Sushi
grasshopper
Trader
Posts: 23
Joined: Sat Jan 14, 2012 2:58 pm

Re: Baluda LibCSS

Post by grasshopper »

Thanks Paul
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Re: Baluda LibCSS

Post by Baluda »

New version, v1.1.2 in post 1.
Changes:
  • Added flushCache option in getCSS function.
  • Changed default for 'useOnlySymbolOnChart' to false.
  • Expanded documentation.
Enjoy,

Paul
Check the MQL4 Market for my best EA's and Indicators.
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Re: Baluda LibCSS

Post by Baluda »

kwanann wrote:f libCSS.useOnlySymbolOnChart is set to true, CSS values calculate properly,but global market trend doesnt.

if libCSS.useOnlySymbolOnChart is set to false, CSS values are wrong but global market trend is correct..
Kwanann,

Try using the latest version of CurrencySlopeStrength, now uploaded to the indicator forum.

Paul
Check the MQL4 Market for my best EA's and Indicators.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Re: Baluda LibCSS

Post by theforexedge »

Paul

Thanks for the update to the lib and getting back to Kwanann about the CSS issue.

Jason
Post Reply

Return to “Nanningbob's Holy Grail Indicator forum”