libCSS - .lmx Suffix Removal Code

theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

I'm just in the process of switching my trading platform to LMAX and I'm struggling to work out how to remove their .lmx suffix to get CSS to only weigh the symbol on the chart rather than compare all currencies...

Here's the code that works fine standard Empty4 platforms, but I can't figure out why its not removing the .lmx :arrrg:

Any help would be much appreciate, as i've scoured the internet and can't find a simple solution

Thanks, Jason

Code: Select all

int libCSSinitSymbols()
{
   int i;
   // Get extra characters on this crimmal's symbol names
   string symbolExtraChars = StringSubstrOld(Symbol(), 6, 4);
   
   if (weighOnlySymbolOnChart)
   {
   libCSSsymbolsToWeigh = Symbol();
   }
 
   // Trim user input
   libCSSsymbolsToWeigh = StringTrimLeft(libCSSsymbolsToWeigh);
   libCSSsymbolsToWeigh = StringTrimRight(libCSSsymbolsToWeigh);
 
   // Add extra comma
   if (StringSubstrOld(libCSSsymbolsToWeigh, StringLen(libCSSsymbolsToWeigh) - 1) != ",")
   {
      libCSSsymbolsToWeigh = StringConcatenate(libCSSsymbolsToWeigh, ",");  
   }  
 
   // Split user input
   i = StringFind( libCSSsymbolsToWeigh, "," );
   while ( i != -1 )
   {
      int size = ArraySize(libCSSsymbolNames);
      string newSymbol = StringConcatenate(StringSubstrOld(libCSSsymbolsToWeigh, 0, i), symbolExtraChars);
      if ( MarketInfo( newSymbol, MODE_TRADEALLOWED ) > libCSSEPSILON )
      {
        ArrayResize( libCSSsymbolNames, size + 1 );
         // Set array
         libCSSsymbolNames[size] = newSymbol;
      }
      // Trim symbols
      libCSSsymbolsToWeigh = StringSubstrOld(libCSSsymbolsToWeigh, i + 1);
      i = StringFind(libCSSsymbolsToWeigh, ",");
   }//
 
 

User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

libCSS - .lmx Suffix Removal Code

Post by milanese »

Please do not repeat your postings in different topics...., it is enough to do your request in one topic!

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

Tommaso

Sorry and noted for future postings..

I just wasn't sure where was best to post as I know Paul doesn't frequent the forum that often, so i thought Coders Hangout was probably better, as I'm sure this problem occurs quite often, but as hard as i've tried I just can't figure how to remove the .lmx suffix.

Jason
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

libCSS - .lmx Suffix Removal Code

Post by milanese »

theforexedge » Thu May 29, 2014 11:30 am wrote:Tommaso

Sorry and noted for future postings..

I just wasn't sure where was best to post as I know Paul doesn't frequent the forum that often, so i thought Coders Hangout was probably better, as I'm sure this problem occurs quite often, but as hard as i've tried I just can't figure how to remove the .lmx suffix.

Jason
it should work if you set extern bool weighOnlySymbolOnChart = true and
extern bool showOnlySymbolOnChart = true
and change your int initSymbols() with this one..

Code: Select all

int initSymbols()
{
   int i;
  
   // Get extra characters on this crimmal's symbol names
   string symbolExtraChars = StringSubstrOld(Symbol(), 6, 4);

   
      
   // Trim user input
   symbolsToWeigh = StringTrimLeft(symbolsToWeigh);
   symbolsToWeigh = StringTrimRight(symbolsToWeigh);

   // Add extra comma
   if (StringSubstr(symbolsToWeigh, StringLen(symbolsToWeigh) - 1) != ",")
   {
      symbolsToWeigh = StringConcatenate(symbolsToWeigh, ",");   
   }   
   
   // Build symbolNames array as the user likes it
   if ( autoSymbols )
   {
      createSymbolNamesArray();
   }
   
   else
   {
      // Split user input
      i = StringFind( symbolsToWeigh, "," ); 
      while ( i != -1 )
      {
         int size = ArraySize(symbolNames);
         string newSymbol = StringConcatenate(StringSubstr(symbolsToWeigh, 0, i), symbolExtraChars);
         if ( MarketInfo( newSymbol, MODE_TRADEALLOWED ) > EPSILON )
         {
            ArrayResize( symbolNames, size + 1 );
            // Set array
            symbolNames[size] = newSymbol;
         }
         // Trim symbols
         symbolsToWeigh = StringSubstrOld(symbolsToWeigh, i + 1);
         i = StringFind(symbolsToWeigh, ","); 
      }
   }
  if ( weighOnlySymbolOnChart )
   {
      symbolsToWeigh = Symbol();
   }
   // Kill unwanted symbols from array
   if ( showOnlySymbolOnChart )
   {
      symbolCount = ArraySize(symbolNames);
      string tempNames[];
      for ( i = 0; i < symbolCount; i++ )
      {
         for ( int j = 0; j < CURRENCYCOUNT; j++ )
         {
            if ( StringFind( Symbol(), currencyNames[j] ) == -1 )
            {
               continue;
            }
            if ( StringFind( symbolNames[i], currencyNames[j] ) != -1 )
            {  
               size = ArraySize( tempNames );
               ArrayResize( tempNames, size + 1 );
               tempNames[size] = symbolNames[i];
               break;
            }
         }
      }
      for ( i = 0; i < ArraySize( tempNames ); i++ )
      {
         ArrayResize( symbolNames, i + 1 );
         symbolNames[i] = tempNames[i];
      }
   }
   
   symbolCount = ArraySize(symbolNames);
   // Print("symbolCount: ", symbolCount);

   for ( i = 0; i < symbolCount; i++ )
   {
      // Increase currency occurrence
      int currencyIndex = getCurrencyIndex(StringSubstrOld(symbolNames[i], 0, 3));
      currencyOccurrences[currencyIndex]++;
      currencyIndex = getCurrencyIndex(StringSubstrOld(symbolNames[i], 3, 3));
      currencyOccurrences[currencyIndex]++;
   }   
   
   
   userTimeFrame = PERIOD_D1;
   if ( autoTimeFrame )
   {
      userTimeFrame = Period();
   }
   else
   {   
		if ( timeFrame == "M1" )       userTimeFrame = PERIOD_M1;
		else if ( timeFrame == "M5" )  userTimeFrame = PERIOD_M5;
		else if ( timeFrame == "M15" ) userTimeFrame = PERIOD_M15;
		else if ( timeFrame == "M30" ) userTimeFrame = PERIOD_M30;
		else if ( timeFrame == "H1" )  userTimeFrame = PERIOD_H1;
		else if ( timeFrame == "H4" )  userTimeFrame = PERIOD_H4;
		else if ( timeFrame == "D1" )  userTimeFrame = PERIOD_D1;
		else if ( timeFrame == "W1" )  userTimeFrame = PERIOD_W1;
		else if ( timeFrame == "MN" )  userTimeFrame = PERIOD_MN1;
	}
}
here it works with forex.com that has pro as suffix

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

Tommaso

Thanks for the code which i've tried to cut and paste into the EA (see attached)

I've tried on both the LMAX & FTT Empty4 installs and it's not working now on either, so not sure what i've done :oops:

My coding is quite limited but i'm learning bit by bit, so please excuse any glaring errors in my efforts to add CSS to Steve's 10.7 trade helper..

Just wondering if the problem could be coming from the SplitSymbol(); call line 1218

Anyway hope you can fix it... :smile:

Jason
You do not have the required permissions to view the files attached to this post.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

libCSS - .lmx Suffix Removal Code

Post by milanese »

theforexedge » Thu May 29, 2014 1:18 pm wrote:Tommaso

Thanks for the code which i've tried to cut and paste into the EA (see attached)

I've tried on both the LMAX & FTT Empty4 installs and it's not working now on either, so not sure what i've done :oops:

My coding is quite limited but i'm learning bit by bit, so please excuse any glaring errors in my efforts to add CSS to Steve's 10.7 trade helper..

Just wondering if the problem could be coming from the SplitSymbol(); call line 1218

Anyway hope you can fix it... :smile:

Jason
Try the attached one..
H4Buy70LevelMod.mq4
Cheers :)

Tommaso
You do not have the required permissions to view the files attached to this post.
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

Tommaso

Thanks you for taking the time to look at the code... :smile:

It works OK but its now weighing all the currency symbols and not just the symbol on the chart..

I guess when its reading the string with all the currency pairs its not including the .lmx suffix, so works OK..

Just now need to figure out how to just show WeighOnlySymbolsOnChart :good:

Jason
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

libCSS - .lmx Suffix Removal Code

Post by milanese »

theforexedge » Thu May 29, 2014 4:07 pm wrote:Tommaso

Thanks you for taking the time to look at the code... :smile:

It works OK but its now weighing all the currency symbols and not just the symbol on the chart..

I guess when its reading the string with all the currency pairs its not including the .lmx suffix, so works OK..

Just now need to figure out how to just show WeighOnlySymbolsOnChart :good:

Jason
this would be a TMA slope if you only weight the symbol on the chart..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

Tommaso

Ah yes its a TMA Slope, but yes that's what I want to use to see if the currencies and trending or in reversal.

I always just think of it as CSS :oops:

Jason
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

libCSS - .lmx Suffix Removal Code

Post by theforexedge »

Tommaso

Do you mean that there is an easier way of doing this?

I guess as my coding skills are quite limited and I used to use the CSS code from Steve's shell i've just cut and pasted the libCSS..

I was using the CSS weighing all the currency pairs, but I found that there are two conditions I wanted to make sure are happening:

1. There is s currency cross

2. Top or bottom reversal

and I found just weighing the symbols on the charts worked..

Anyway thinks for all your help.. :good:

Jason
Post Reply

Return to “Coders Hangout”