Board TechNews

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

better showing mql code in code box

Post by milanese »

Hello :hi:

I am working on a better code visualyzing for mql code here this is now in an early alpha state but if you use the code tag with code=mql (just use the quote here, if you don't get it, to see how) the mql code is better readable..

Exp.:

Code: Select all

if(OrderType() == OP_BUY) //we have a buy order
		{   
		ticket=OrderTicket();
		  
			{
			   
				NewSL=NormalizeDouble(ExtMapBuffer6[1]-(HA_SLMovingDistance*Point), Digits);
			   
				if((Bid-NewSL)>(HA_SLMovingDistance*Point))
				if((Bid-NewSL)>(SetBEminPip*Point))
				{
				if((NormalizeDouble(OrderStopLoss(), Digits) != NormalizeDouble(NewSL, Digits)))
					if(		 ((NewSL>OrderStopLoss())||(OrderStopLoss()<(1*Point))) &&   (NewSL!=0) && (NewSL < Bid - (10*multiplier*Point))   )
					{
					
						Alert("SetBEAndJump :Attempting to move SL of ",symbol," to ",NewSL);
						Print("SetBEAndJump :Attempting to move SL of ",symbol," to ",NewSL);
						ModifyOrder(ticket,NewSL,0);
					}
				}
			}		   
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
dudest
Trader
Posts: 1847
Joined: Tue May 08, 2012 2:37 pm

Re: Board TechNews

Post by dudest »

Great work mate!! Looking good :)

Cheers!
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: Board TechNews

Post by SteveHopwood »

Fabulous Tommaso. Thanks.

: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.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: better showing mql code in code box

Post by milanese »

milanese » Mon Jan 27, 2014 2:43 pm wrote:Hello :hi:

I am working on a better code visualyzing for mql code here this is now in an early alpha state but if you use the code tag with code=mql (just use the quote here, if you don't get it, to see how) the mql code is better readable..

Exp.:

Code: Select all

if(OrderType() == OP_BUY) //we have a buy order
		{   
		ticket=OrderTicket();
		  
			{
			   
				NewSL=NormalizeDouble(ExtMapBuffer6[1]-(HA_SLMovingDistance*Point), Digits);
			   
				if((Bid-NewSL)>(HA_SLMovingDistance*Point))
				if((Bid-NewSL)>(SetBEminPip*Point))
				{
				if((NormalizeDouble(OrderStopLoss(), Digits) != NormalizeDouble(NewSL, Digits)))
					if(		 ((NewSL>OrderStopLoss())||(OrderStopLoss()<(1*Point))) &&   (NewSL!=0) && (NewSL < Bid - (10*multiplier*Point))   )
					{
					
						Alert("SetBEAndJump :Attempting to move SL of ",symbol," to ",NewSL);
						Print("SetBEAndJump :Attempting to move SL of ",symbol," to ",NewSL);
						ModifyOrder(ticket,NewSL,0);
					}
				}
			}		   
Cheers :)

Tommaso
Now this feature is standart for the codebox it works without using code=mql...

Code: Select all

bool CheckTradeAllowedMargin()//we must check margin before opening a trade
{ bool allowed=true;
	if(IsTesting()==false)
	{
		if((MarketInfo(Symbol(),MODE_MARGINREQUIRED)*lot)>=(AccountFreeMargin()/2))allowed=false;
		if(AccountMargin()>0)
		{
			double freemarginpercentile=(AccountEquity()/AccountMargin())*100;
			if(freemarginpercentile<RequiredMarginPercentile)allowed=false;
		}  
   }
	return(allowed);
} 
note this will only work in new posts, old posts are not changed..
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
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Board TechNews

Post by fxozgirl »

Hi Tomasso, your work on the forum is outstanding...thanks for all your efforts :clap:
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: better showing mql code in code box

Post by milanese »

Hello ,

as I told the new codebox is a project in development now you find a new version, but unfortunately you must use code=mql in the fist [] (do hit the quote button of this post if you don't understand how), this about our old post using code, they work only so and reparsing of all old posts would be to much work..
The new code box highlightes mql syntax, this not complett at the moment but I am working to add the complett mql4 syntax so the code is again much better readable

Cheers :)

Tommaso

Code: Select all

int start()
  {
   int i, counted_bars = IndicatorCounted();
   if(counted_bars< 0) 
      return(-1);
   if(counted_bars> 0) 
      counted_bars--;
   int limit = Bars - 1 - counted_bars; 
   
   for(i=limit; i>=0; i--)
   {
      curDate = stripToDate_(Time[i]); 
      int g = 0;
      while(g<Qty){
         Session_(saName, curDate, lastDate, t1, t2, lo, hi, pip, col[g], g, i); 
         g++;
      }
   }  
   return(0);
  }
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
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: Board TechNews

Post by milanese »

Using code=cpp the new code box will highlight too c++ code if needed ;)

exp:

Code: Select all

// crappy.cpp
#include <iostream>
using namespace std;
#include "SimpleH.h"

namespace nmspace
{
 void myclass::Crap()
 {
  cout << "I'm called within a crappy DLL!";
 }
}
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
dudest
Trader
Posts: 1847
Joined: Tue May 08, 2012 2:37 pm

Re: Board TechNews

Post by dudest »

You are a machine my friend!, good stuff! :)
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: Board TechNews

Post by milanese »

dudest » Wed Jan 29, 2014 10:52 pm wrote:You are a machine my friend!, good stuff! :)
Thank you mate! I think with all the crap changes that are coming we will have more need for the codebox than ever before...

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
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: Board TechNews

Post by milanese »

Hi all,
now I got it :smile:
Now the code box makes as standart, without using "=mql" after the code tag syntax highlight for mql4 code, now you can use it with all comfort :)
Near all mq4 syntax is embedded now...
Enjoy posting your code in the new code box.

Cheers :)
Tommaso

Code: Select all

extern color ExtColor=LightSeaGreen;

string ExtName="Exposure";
string ExtSymbols[SYMBOLS_MAX];
int    ExtSymbolsTotal=0;
double ExtSymbolsSummaries[SYMBOLS_MAX][7];
int    ExtLines=-1;
string ExtCols[8]={"Symbol",
                   "Deals",
                   "Buy lots",
                   "Buy price",
                   "Sell lots",
                   "Sell price",
                   "Net lots",
                   "Profit"};
int    ExtShifts[8]={ 10, 80, 130, 180, 260, 310, 390, 460 };
int    ExtVertShift=14;
double ExtMapBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init()
  {
	IndicatorShortName(ExtName);
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexStyle(0,DRAW_NONE);
   IndicatorDigits(0);
	SetIndexEmptyValue(0,0.0);
  }
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
Locked

Return to “Lounge”