Monday, 22 August 2011

Formatting Source code for your Blog - MQL4 MQL5 ASP PHP CSS JavaScript HTML ASP.Net C# VB.Net Visual Basic

Here is a very useful Source Code Formatter which is very handy if you write a blog Its great, there are no need for hosted css files or anything ... Just copy your source code in the box ... press the go button and then copy out the formatted html ... brilliant !

http://codeformatter.blogspot.com/2009/06/about-code-formatter.html

Here is an example

 //+------------------------------------------------------------------+ 
//| Calculate open positions                 
//+------------------------------------------------------------------+ 
int CalculateCurrentOrders(string symbol) 
{ 
  int buys=0,sells=0; 
 
  for(int i=0;i<OrdersTotal();i++) 
   { 
   if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; 
   if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC) 
    { 
     if(OrderType()==OP_BUY) buys++; 
     if(OrderType()==OP_SELL) sells++; 
    } 
   } 
    
  // return orders volume 
  if(buys>0) return(buys); 
  else    return(-sells); 
} 
  

You can configure a number of format settings, however this is the code block i use for this blog:

 
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> 
Your Code Block</code></pre> 

No comments:

Post a Comment