ProTrader Trading Platform Official  Forum


Go Back   ProTrader Trading Platform Official Forum > Scripting

Scripting Autotrading, Indicators, Strategies, Advisors. MQL, EasyLanguage, PTL Builder

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2010, 05:11 PM
number13 number13 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 7
Rep Power: 0
number13 is on a distinguished road
Default Interacting with MySQL

Is there any documentation about performing SQL queries from PTL scripts to MySQL server?
How to fetch data from SELECT query results?
Any examples?
Reply With Quote
  #2  
Old 02-08-2010, 07:00 AM
nicky nicky is offline
ProTrader Gold member
 
Join Date: Mar 2009
Posts: 566
Rep Power: 2
nicky is on a distinguished road
Send a message via ICQ to nicky Send a message via Skype™ to nicky
Default

No, it itsn't, because PTL Builder doesn't support SQL directly.
But you can crete a C#/VB.NET project from PTL Builder and access to the DB via .NET classes.

Last edited by nicky : 02-08-2010 at 07:02 AM.
Reply With Quote
  #3  
Old 02-08-2010, 07:47 AM
number13 number13 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 7
Rep Power: 0
number13 is on a distinguished road
Default

I couldn't create a VB.NET project because the PTL Builder crashes under Vista when I'm trying to launch any VB script, even an empty one like this:
Code:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing
Imports PTLRuntime.NETScript

Namespace test20

    ' <summary>
    ' test20
    ' test
    ' </summary>
	Public Class test20
		Inherits NETStrategy
    
		Public Sub New()
    		MyBase.New() 
   	
			MyBase.Author = "test"
			MyBase.Comments = "test"
			MyBase.Company = ""
			MyBase.Copyrights = ""
			MyBase.DateOfCreation = "08.02.2010"
			MyBase.ExpirationDate = 0
			MyBase.Version = "1.0"
			MyBase.Password = "66b4a6416f59370e942d353f08a9ae36"
			MyBase.ProjectName = "test20"

		End Sub
    
		' <summary>
        ' Entry point. This function is called when new quote comes 
        ' </summary>
		Overrides Sub OnQuote()
			'do nothing
		End Sub

	End Class

End Namespace
So, I'm going to use native PT language with libmysql.dll. However, there is a problem with DLL import. When I'm trying to import some DLL, for example:
Code:
imported from "user32.dll" function bool MessageBeep (int myarg);

function void OnQuote() entry
{
	//Alert(Symbol); //Symbol is the instrument's name
};

function bool Init() entry
{
	user32.MessageBeep(0);
	Alert("Hello world!");
};
, the PTL Builder tells me about denied access to C:\Windows\system32\wfp. Or to C:\Windows\system32\LogFiles\WMI\RtBackup if it is running with admin's privileges. The same occurs under Windows Server 2008.

Is there any solution?
Reply With Quote
  #4  
Old 02-08-2010, 08:41 AM
nicky nicky is offline
ProTrader Gold member
 
Join Date: Mar 2009
Posts: 566
Rep Power: 2
nicky is on a distinguished road
Send a message via ICQ to nicky Send a message via Skype™ to nicky
Default

If PTL Builder cannot find the required .dll in the ..\Include folder it tries to find it into the system directory. Please copy this dll into ...\Include folder or give PTL Builder more privileges .
Reply With Quote
  #5  
Old 02-08-2010, 09:25 AM
number13 number13 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 7
Rep Power: 0
number13 is on a distinguished road
Default

Thanks. Now it seems to work.

By the way, one more stupid question:
Where can I take a look at the log written by Print() function?
Reply With Quote
  #6  
Old 02-08-2010, 10:48 AM
nicky nicky is offline
ProTrader Gold member
 
Join Date: Mar 2009
Posts: 566
Rep Power: 2
nicky is on a distinguished road
Send a message via ICQ to nicky Send a message via Skype™ to nicky
Default

The log is displayed by Strategy panel (client) or Strategy results (builder).
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Follow pfsoft on Twitter

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.