great job!!!!
happy new year and God bless you...
help for pipware-charts setting 2 replies
Pipware MiniCharts - looking for similar indicator 0 replies
Pipware minichart alternative? 0 replies
#import "kernel32.dll"
bool GetComputerNameA(string lpBuffer, int& nSize[] );
#import
int nSize[1];
string lpBuffer;
int init()
{
lpBuffer ='';
nSize[0] = 65;
bool res = GetComputerNameA( lpBuffer, nSize );
return(0);
}
#import "kernel32.dll"
bool GetComputerNameA(int& lpBuffer[], int& nSize[] );
#import
int nSize[1];
int lpBuffer[];
string TextFromBuffer( int& buffer[], int size )
{
string text="";
for ( int i=0; i<ArraySize(buffer); i++ )
{
text = text + CharToStr(buffer[i] & 0x000000FF)
+ CharToStr(buffer[i]>>8 & 0x000000FF)
+ CharToStr(buffer[i]>>16 & 0x000000FF)
+ CharToStr(buffer[i]>>24 & 0x000000FF);
}
text = StringSubstr( text, 0, size);
return (text);
}
//+-------------------------------------------------------------------------------------------------------------+
//| Custom indicator initialization function |
//+-------------------------------------------------------------------------------------------------------------+
int init()
{
nSize[0] = 16;
ArrayResize( lpBuffer, MathCeil( nSize[0]/4 ) );
bool res = GetComputerNameA( lpBuffer, nSize );
Print( "PCName: " + nSize[0] + " chars '" + TextFromBuffer( lpBuffer, nSize[0]) + "'" );
return(0);
}
DislikedAnyone know how to get this function working?
I get the size of my computer name (6) into nSize[0] but I can't get any readable text form lpBuffer.Ignored
DislikedSTRATMAN, you could have pm me and i would have told you all that..lol.. YOU'RE A GENIUS MY FRIEND. Happy new year to you and your family.
JEANIgnored
//+------------------------------------------------------------------+
//| pipware.datetime.mqh |
//| [email protected] |
//| http://www.pipware.com |
//+------------------------------------------------------------------+
#property copyright "[email protected]"
#property link "http://www.pipware.com"
//+------------------------------------------------------------------+
//| Externs |
//+------------------------------------------------------------------+
extern string pw.datetime.Note01 = "## Valid Day values: ##";
extern string pw.datetime.Note02 = "## Mon,Tue,Wed,Thu,Fri,Sat,Sun ##";
extern string pw.datetime.Note03 = "## Valid Hour values: ##";
extern string pw.datetime.Note04 = "## 0 to 24 ##";
extern string pw.datetime.Note05 = "## Valid Time Zone values: ##";
extern string pw.datetime.Note06 = "## -13 to 13 (UTC/GMT) ##";
extern string pw.datetime.Note07 = "## B R O K E R ##";
extern string pw.datetime.Note08 = "## Enter Metatrader Times ##";
extern string pw.datetime.Note09 = "## in Time Zone of Broker ##";
extern string pw.datetime.Note10 = "## Broker Weekly Open? ##";
extern string pw.datetime.BrokerStartDay = "Sun";
extern int pw.datetime.BrokerStartHour = 22;
extern string pw.datetime.Note11 = "## Broker Weekly Close? ##";
extern string pw.datetime.BrokerEndDay = "Fri";
extern int pw.datetime.BrokerEndHour = 22;
extern string pw.datetime.Note12 = "## Broker Time Zone ##";
extern string pw.datetime.Note13 = "## Do Not adjust unless ##";
extern string pw.datetime.Note14 = "## you have a time problem ##";
extern int pw.datetime.BrokerTimeZone = 0;
extern bool pw.datetime.ShowAsLocalTimes = false;
//+------------------------------------------------------------------+
//| defines |
//+------------------------------------------------------------------+
#define pw.datetime.DAY_HOURS 24
#define pw.datetime.DAY_MINUTES 1440
#define pw.datetime.DAY_SECONDS 86400
#define pw.datetime.WEEK_SECONDS 604800
#define pw.datetime.SUNDAY 0
#define pw.datetime.MONDAY 1
#define pw.datetime.TUESDAY 2
#define pw.datetime.WEDNESDAY 3
#define pw.datetime.THURSDAY 4
#define pw.datetime.FRIDAY 5
#define pw.datetime.SATURDAY 6
#define pw.datetime.BROKER_MAX_DIFF 300 //seconds
//+------------------------------------------------------------------+
//| DLL imports |
//+------------------------------------------------------------------+
#import "kernel32.dll"
int GetTimeZoneInformation( int& TZInfoArray[] );
#import
#define TIME_ZONE_ID_UNKNOWN 0
#define TIME_ZONE_ID_STANDARD 1
#define TIME_ZONE_ID_DAYLIGHT 2
int TZInfoArray[43];
//+------------------------------------------------------------------+
//| Variables |
//+------------------------------------------------------------------+
bool pw.datetime.gIsBrokerOpen;
datetime pw.datetime.gLocalTime;
int pw.datetime.gLocalUTCOffset;
datetime pw.datetime.gBrokerTime;
int pw.datetime.gBrokerUTCOffset;
datetime pw.datetime.gUTCTime;
int pw.datetime.gBrokerLocalDiff;
//+------------------------------------------------------------------+
//| pw.datetime Functions |
//+------------------------------------------------------------------+
void pw.datetime.Init()
{
//UTC Time
pw.datetime.gUTCTime = pw.datetime.TimeUTC();
//Local time and UTC offset
pw.datetime.gLocalTime = TimeLocal();
pw.datetime.gLocalUTCOffset = pw.datetime.gLocalTime - pw.datetime.gUTCTime;
//Broker Time and UTC offset
//Note that broker time may stop at close of week and restart at beginning of week
pw.datetime.gBrokerTime = TimeCurrent();
pw.datetime.gBrokerUTCOffset = pw.datetime.GetBrokerUTCOffset();
}
void pw.datetime.Update()
{
pw.datetime.gUTCTime = pw.datetime.TimeUTC();
pw.datetime.gLocalTime = TimeLocal();
// Note that broker time may stop at close of week and restart at beginning of week
pw.datetime.gBrokerTime = TimeCurrent();
pw.datetime.gBrokerLocalDiff = pw.datetime.GetBrokerLocalDiff();
}
string pw.datetime.ToString()
{
return ( "BrokerLocalDiff: " + DoubleToStr( pw.datetime.gBrokerLocalDiff, 0 ) + ", IsBrokerOpen: " + DoubleToStr( pw.datetime.gIsBrokerOpen, 0 )
+ ",n UTC(0): " + pw.datetime.DateTimeToString( pw.datetime.gUTCTime )
+ ", Local(" + DoubleToStr( MathRound( pw.datetime.gLocalUTCOffset/3600 ),0) + "): " + pw.datetime.DateTimeToString( pw.datetime.gLocalTime )
+ ", Broker(" + DoubleToStr( MathRound( pw.datetime.gBrokerUTCOffset/3600 ),0) + "): " + pw.datetime.DateTimeToString( pw.datetime.gBrokerTime )
);
}
datetime pw.datetime.BrokerTime ( datetime localTime )
{
return ( localTime - pw.datetime.gLocalUTCOffset + pw.datetime.gBrokerUTCOffset );
}
datetime pw.datetime.ChoiceTime ( datetime localTime )
{
if ( pw.datetime.ShowAsLocalTimes ) return ( localTime );
return ( pw.datetime.BrokerTime( localTime ) );
}
string pw.datetime.DateTimeToString( datetime dt )
{
return ( pw.datetime.StringFromDay( TimeDayOfWeek( dt ) ) + " " + TimeToStr( dt, TIME_DATE | TIME_MINUTES | TIME_SECONDS ) );
}
int pw.datetime.DayFromString ( string day )
{
if ( day=="Mon" ) return ( pw.datetime.MONDAY );
if ( day=="Tue" ) return ( pw.datetime.TUESDAY );
if ( day=="Wed" ) return ( pw.datetime.WEDNESDAY );
if ( day=="Thu" ) return ( pw.datetime.THURSDAY );
if ( day=="Fri" ) return ( pw.datetime.FRIDAY );
if ( day=="Sat" ) return ( pw.datetime.SATURDAY );
if ( day=="Sun" ) return ( pw.datetime.SUNDAY );
return ( pw.datetime.MONDAY );
}
int pw.datetime.GetBrokerLocalDiff()
{
return ( pw.datetime.gBrokerTime - pw.datetime.BrokerTime( pw.datetime.gLocalTime ) );
}
int pw.datetime.GetBrokerUTCOffset()
{
int timezone = pw.datetime.BrokerTimeZone * 3600;
if ( pw.system.GetComputerName()=="FOREXLAB" )
{
string company = TerminalCompany();
if ( company == "Alpari (UK) Ltd." ) timezone = 3600;
if ( company == "Avail Trading Corp." ) timezone = 0;
if ( company == "Dukascopy (Suisse) SA" ) timezone = 0;
if ( company == "Forex Trading Direct LLC" ) timezone = 7200;
if ( company == "FX Solutions Australia" ) timezone = -18000;
if ( company == "FXCM Liquidity Connection" ) timezone = 3600;
if ( company == "FXDD" ) timezone = 120;
if ( company == "FXOpen Investments Inc." ) timezone = 7200;
if ( company == "GAIN Capital - Forex.com UK Ltd." ) timezone = 0;
if ( company == "GCI Financial Ltd." ) timezone = -18000;
if ( company == "Go Markets Pty Ltd" ) timezone = 7200;
if ( company == "Interbank FX, LLC." ) timezone = 0;
if ( company == "Jade Investments Group, LLC" ) timezone = 3600;
if ( company == "MB Trading Futures, Inc." ) timezone = -18000;
if ( company == "ODL Securities" ) timezone = 0;
if ( company == "One Corporation" ) timezone = 3600;
if ( company == "Tadawulfx" ) timezone = -25200;
if ( company == "Vantage FX Pty Ltd" ) timezone = 7200;
}
return ( timezone );
}
string pw.datetime.StringFromDay ( int day )
{
if ( day==pw.datetime.MONDAY ) return ( "Mon" );
if ( day==pw.datetime.TUESDAY ) return ( "Tue" );
if ( day==pw.datetime.WEDNESDAY )return ( "Wed" );
if ( day==pw.datetime.THURSDAY ) return ( "Thu" );
if ( day==pw.datetime.FRIDAY ) return ( "Fri" );
if ( day==pw.datetime.SATURDAY ) return ( "Sat" );
if ( day==pw.datetime.SUNDAY ) return ( "Sun" );
return ( "Mon" );
}
datetime pw.datetime.TimeUTC()
{
int DST = GetTimeZoneInformation(TZInfoArray);
if (DST == 1)
DST = 3600;
else
DST = 0;
return( TimeLocal() + DST + (TZInfoArray[0] + TZInfoArray[42]) * 60 );
}
Dislikedvery impressive... certainly a lot of work... thanks again for all your great work... i'm going fishing now.. i live right on the ocean in tasmania.. and it's a great day here... catch you later... jeanIgnored
DislikedHi Stratman..
I cannot load the latest thv-trix-pipware-v2.0 into chart. (ODL)
Tried download the indi several times from your site but still i got the same problem. i also tried download odl again but still cannot load this trix. Now i'm using the old thv_trix_pipware_v1.0.
Can you help?
Thank you.
MamiIgnored