stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Baluda LibCSS
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2905
Page 1 of 4
Author:  Baluda [ Mon Aug 05, 2013 10:39 am ]
Post subject:  Baluda LibCSS

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
Author:  theforexedge [ Mon Aug 05, 2013 12:22 pm ]
Post subject:  Re: Baluda LibCSS

Paul

Thank you for this... :D

Jason
Author:  SteveHopwood [ Mon Aug 05, 2013 8:20 pm ]
Post subject:  Re: Baluda LibCSS

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
Author:  phil_trade [ Mon Aug 05, 2013 8:28 pm ]
Post subject:  Re: Baluda LibCSS

Who is the best ? Paul, for sure ;)

Great job !
Author:  kwanann [ Mon Aug 05, 2013 10:34 pm ]
Post subject:  Re: Baluda LibCSS

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?
Author:  aSushiRoll [ Tue Aug 06, 2013 2:24 am ]
Post subject:  Re: Baluda LibCSS

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
Author:  grasshopper [ Tue Aug 06, 2013 5:40 am ]
Post subject:  Re: Baluda LibCSS

Thanks Paul
Author:  Baluda [ Tue Aug 06, 2013 8:50 am ]
Post subject:  Re: Baluda LibCSS

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
Author:  Baluda [ Tue Aug 06, 2013 8:54 am ]
Post subject:  Re: Baluda LibCSS

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
Author:  theforexedge [ Tue Aug 06, 2013 8:59 am ]
Post subject:  Re: Baluda LibCSS

Paul

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

Jason
All times are UTC Page 1 of 4