1. 首页
  2. 易语言 - EasyLanguage
  3. 设定分析技术,只能在某台电脑上运行 Restricting access to a PC

设定分析技术,只能在某台电脑上运行 Restricting access to a PC

本文描述如何实现让您的分析技术只能在某一太电脑上运行。 This page describes how to restrict studies so that they can only be run on a particular PC. To restrict your code fully you need to add this functionality and then see the Protecting EasyLanguage Code page.

Using the CustomerID allows you to restrict access to one account. However, that account holder can still use the code on multiple computers. The Network ID allows you to restrict access to EL code to a specific computer.

The first thing to do is get the Network ID from the person you will be sending the strategy/indicator to. The Network ID is found from the main ‘Help’ menu, under ‘About TradeStation x.x’…

Access to the Network ID is not available directly from EasyLanguage. But here is a DLL that will return the Network ID to an EasyLanguage program.

          ELNetwork.dll

This DLL can be placed in your computer’s equivalent to this subdirectory: \WINDOWS\system32\. If preferred, it can also be placed into your \TradeStation (Build WXYZ)\Program\ subdirectory.

The DLL function ELNETWORKID can be called using EasyLanguage code like the following:

external:  "ELNetwork.dll", int, "ELNETWORKID", IEasyLanguageObject ; 
 
variables: 
	MyNetworkID( 678910 ) ; 
 
if CurrentBar = 1 then 
	MyNetworkID = ELNetworkID( self ) ; 
	 
Plot1( MyNetworkID, "NetworkID" ) ;

Note that you put the Network ID in a variable (not an input) and you put the begin…end loop around your entire code (except the Inputs: and Variables: declarations).

The following code is not needed for EasyLanguage. It is the C++ code for the above DLL in case you’re interested:

#import "C:\Program Files\TradeStation 8.1 (Build 3159)\Program\tskit.dll" no_namespace 
 
BOOL __stdcall DllMain(HANDLE hModule, 
					   DWORD ul_reason_for_call, 
					   LPVOID lpReserved 
					   ) 
{ 
	switch( ul_reason_for_call ) 
	{ 
		case DLL_PROCESS_ATTACH: 
		case DLL_THREAD_ATTACH: 
		case DLL_THREAD_DETACH: 
		case DLL_PROCESS_DETACH: 
		break;  
	} 
	return TRUE ; 
} 
 
 
int __stdcall ELNETWORKID( IEasyLanguageObject* pEL ) 
{ 
		return pEL->Platform->NetworkID ; 
}
更新于 2020年5月15日

这篇文章对您有帮助吗?

相关的话题

留言评论