<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Financial Blog &#187; easylanguage</title>
	<atom:link href="https://fx1.net/blog/tag/easylanguage/feed/" rel="self" type="application/rss+xml" />
	<link>https://fx1.net/blog</link>
	<description>Forex, Futures, Programming</description>
	<lastBuildDate>Fri, 06 Mar 2015 16:13:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1</generator>
	<item>
		<title>Create perfect trading system in Easylanguage</title>
		<link>https://fx1.net/blog/create-perfect-trading-system-in-easylanguage/</link>
		<comments>https://fx1.net/blog/create-perfect-trading-system-in-easylanguage/#comments</comments>
		<pubDate>Fri, 06 Mar 2015 15:55:44 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Easylanguage]]></category>
		<category><![CDATA[blackbox]]></category>
		<category><![CDATA[easylanguage]]></category>
		<category><![CDATA[tradestation]]></category>
		<category><![CDATA[trading system]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2157</guid>
		<description><![CDATA[Easylanguage has look-forward-protection, means you cannot get access to future. This is something very good, this avoids to make mistakes. Some platforms such as Wealth-Lab4 did not have such protection. [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Easylanguage has look-forward-protection, means you cannot get access to future. This is something very good, this avoids to make mistakes. Some platforms such as Wealth-Lab4 did not have such protection. This made it easy for novice developers to look into the future and have kind of edge. Bad part is that they did not know anything about their fatal mistake. They have paid real-money to determine their mistakes</h3>
<h1>Objective</h1>
<p>I will show you a method which makes it possible to look into the future from Easylanguage. Of course we show this method only educational to show traders the possibility of such things in Easylanguage. This should prevent novice traders blindly believe other peoples black-box codes.</p>
<h1>Requirements</h1>
<p>I am using <a href='/sharedvar.php'>SharedVar</a> in my test but this could be also another DLL based tool which can cache future bars in memory or on disk. What we basically do is to store the future into the memory and look at them from past(bars). Is it such easy.</p>
<h1>Get started</h1>
<p>After reading about SharedVar library which makes it possible to cache all kind of data (string,boolean,double,integer) and lookup. Best part is that SV makes it possible doing this across all kind of trading tools, this tool is not made only for specific platform.</p>
<p>I would like to post following code, this code is very basic to understand:</p>
<pre class="brush: php; title: ; notranslate">
external: &quot;SharedVar-a32.dll&quot;, int,		&quot;svInit&quot;		,string;
external: &quot;SharedVar-a32.dll&quot;, bool,	&quot;svSetValue&quot;	,int,string,double;
external: &quot;SharedVar-a32.dll&quot;, bool,	&quot;svSetString&quot;	,int,string,string;
external: &quot;SharedVar-a32.dll&quot;, double,	&quot;svGetDouble&quot;	,int,string;
external: &quot;SharedVar-a32.dll&quot;, string,	&quot;svGetString&quot;	,int,string;
external: &quot;SharedVar-a32.dll&quot;, bool,	&quot;svServerStart&quot;;

Vars: maxbarsahead(10),qq(0),intrabarpersist atr(0),tradeok(false);
Vars: intrabarpersist sv(0);

method double getclose(int id)
begin
	return(svGetDouble(sv,NumtoStr(Barnumber+id,0)));
end;



Once begin
	svServerStart();
	sv=svInit(&quot;PerfectSystem&quot;);
	atr=AvgTrueRange(14);	
end;


svSetValue(sv,NumtoStr(Barnumber,0),Close);

if(sv&gt;=0) then
begin
tradeok=false; 
For qq=1 to maxbarsahead 
Begin
	Value1=getclose(qq);	

	// check tp
	if (Value1&gt;0 and Value1&gt;Close+atr) then
	begin
		tradeok=true;		
		break;
	end;
	
	// check sl
	if (Value1&gt;0 and Value1&lt;Close-atr) then
	begin
		tradeok=false;
		break;
	end;
	
End;
If (tradeok) then Buy at this bar on close;
end;

rr
Setstopcontract;
Setprofittarget(atr);
setstoploss(atr*2);

</pre>
<p>What we do is to store all Close prices into SharedVar cache and lookup to future by next execution of strategy. First execution of Strategy does not generate any trades because we dont have any cached data, but if you refresh the chart second time you will have data to lookup from future and it starts working. Our strategy is basically trying to takeprofit ATR(14). I have used EURUSD,15min of 1 full year for my test, but this strategy would deliver perfect equity line on all possible timeframes and symbols. Holy Grail is found.</p>
<p>
<a href="https://fx1.net/blog/wp-content/uploads/2015/03/report11.png"><img src="https://fx1.net/blog/wp-content/uploads/2015/03/report11.png" alt="report1" width="1904" height="823" class="alignleft size-NinzioOneThird wp-image-2167" /></a>
</p>
<h1>Why</h1>
<p>I want to show everyone that everything is possible if you purchase a black-box! Creative coders might make similar holy grail like strategies easly, even in Trading platforms such as Tradestation or Multicharts. The smarter black-box-developer will mix holy-grail-like trading with some loosing streaks, this means the strategy more trusted because too-straigt-equity may not be seen very trusted from most of traders. Generally avoid all kind of blackbox trading systems</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/create-perfect-trading-system-in-easylanguage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Import Tradestation Data into StrategyQuant</title>
		<link>https://fx1.net/blog/import-tradestation-data-into-strategyquant/</link>
		<comments>https://fx1.net/blog/import-tradestation-data-into-strategyquant/#comments</comments>
		<pubDate>Sat, 10 Jan 2015 09:01:39 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Easylanguage]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[easylanguage]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[fileappend]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[strategyquant]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2087</guid>
		<description><![CDATA[Data is 90% of truth if you are back- or forward testing. You need to have Data from reliable source. I want to introduce you how you can export Tradestation/Multicharts [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Data is 90% of truth if you are back- or forward testing. You need to have Data from reliable source. I want to introduce you how you can export Tradestation/Multicharts data with Easylanguage and import it into <a href='/strategyquant.php'>StrategyQuant</a></h3>
<h2>Howto Export in proper format</h2>
<p>
I had introduced <a href='/blog/tradestations-slow-fileappend/'>fastappender</a> in my previous posts, we will use this in order to archive speed. You could of course also skip this and modify my code to use Fileappend command, it would work but just very slow.
</p>
<p>
We will export the data as .csv format with &#8216;;&#8217; seperation. Format will be Date;Time;Open;High;Low;Close;Volume</p>
<pre class="brush: php; title: ; notranslate">
Inputs: ExportDirectory(&quot;c:\DATA1\&quot;);

Vars: OHLC(&quot;&quot;);
Vars: intrabarpersist FN(&quot;&quot;),BInterval(0),intrabarpersist fa(0),string thetime(&quot;&quot;);

// External Definitions
external: &quot;fast_appender.dll&quot;, int, &quot;faInitA&quot;,LPSTR,int; 
external: &quot;fast_appender.dll&quot;, int, &quot;faAppendA&quot;,int,LPSTR; 

Once Begin
	if BarType=1 then BInterval=BarInterVal;
	if BarType=2 then BInterval=24*60; 
	if BarType=3 then BInterval=24*60*7;
	if BarType=4 then BInterval=24*60*30;
	If BarType=12 then BInterval=(Range/1 Point);
	FN=ExportDirectory+getsymbolname+&quot;-&quot;+Numtostr(BInterval,0)+&quot;.csv&quot;;
	fa=faInitA(FN,1);  	
end;

// Adjust time to HH:mm format
if (time&gt;=1000) then	thetime=numtostr(time,0)   else
if (time&gt;=100)  then    thetime=&quot;0&quot;+numtostr(time,0) else
if (time&gt;=10)   then  thetime=&quot;00&quot;+numtostr(time,0) else thetime=&quot;000&quot;+numtostr(time,0);
thetime=midstr(thetime,1,2)+&quot;:&quot;+midstr(thetime,3,2);


OHLC=ELDateToString(Date)+&quot;;&quot;+thetime+&quot;;&quot;
		+Numtostr(o,6)+&quot;;&quot;
		+Numtostr(h,6)+&quot;;&quot;
		+Numtostr(l,6)+&quot;;&quot;
		+Numtostr(c,6)+&quot;;&quot;
		+Numtostr(Volume,1)+Newline;
 
faAppendA(fa,OHLC);
</pre>
</p>
<p>
The output looks like this:<br />
<a href="https://fx1.net/blog/wp-content/uploads/2015/01/csvoutput.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/csvoutput-1024x257.jpg" alt="csvoutput" width="1024" height="257" class="alignnone size-large wp-image-2096" /></a><br />
Volume is 0 because it is forex symbol, this code can export any symbol. This code assumes you have c:\DATA1\ directory exists, if not you can adjust this directory by Input parameter in Easylanguage code. Now we have a valid .csv file of 1 month
</p>
<h2>Import Custom Data into StrateyQuant</h2>
<p>
Start StrategyQuant, Click to Data Manager, make sure you are inside &#8220;History Data&#8221;, click to &#8220;Add Symbol&#8221;. You need to know the properties of Symbol you are importing. Especially Data type is very important.<br />
<a href="https://fx1.net/blog/wp-content/uploads/2015/01/sqimport.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/sqimport-1024x469.jpg" alt="sqimport" width="1024" height="469" class="alignnone size-large wp-image-2099" /></a>
</p>
<p>
This step has added a new symbol into Strategy Quant. Now we need to add Data to that recently added Symbol, to do this you first select new symbol and click to &#8220;Import Data&#8221; button.
</p>
<p>
Select Fileformat as shown on picture and make sure columns are labelled like seen on picture and press Start Import. StrategyQuant will confirm how many bars have been imported and you will have new data available:<br />
<a href="https://fx1.net/blog/wp-content/uploads/2015/01/sqimportdata.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/sqimportdata.jpg" alt="sqimportdata" width="951" height="650" class="alignnone size-full wp-image-2102" /></a>
</p>
<h2>Important</h2>
<p>
Version 3.8 does not support Tradestation Data compression into other Timeframes. They plan to support automatically create other Timeframes automatically. But for 3.8 version you have to import every Timeframe manually.</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/import-tradestation-data-into-strategyquant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tradestation´s slow FileAppend</title>
		<link>https://fx1.net/blog/tradestations-slow-fileappend/</link>
		<comments>https://fx1.net/blog/tradestations-slow-fileappend/#comments</comments>
		<pubDate>Fri, 02 Jan 2015 15:41:06 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Easylanguage]]></category>
		<category><![CDATA[append]]></category>
		<category><![CDATA[easylanguage]]></category>
		<category><![CDATA[fileappend]]></category>
		<category><![CDATA[multicharts]]></category>
		<category><![CDATA[tradestation]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2009</guid>
		<description><![CDATA[Tradestation and Multicharts Fileappend command is too slow for many operations. Here i would like to introduce a solution Compatibility This library is not dedicated for Tradestation. It will work [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Tradestation and Multicharts Fileappend command is too slow for many operations. Here i would like to introduce a solution</h3>
<h2  id=underline>Compatibility</h2>
<p>This library is not dedicated for Tradestation. It will work with every other platform such as Multicharts, Ninjatrader, C#. Our demonstration here is just for demo.</p>
<h2  id=underline>Details</h2>
<p>Lets imagine you want to export OHLC Data as CSV to be able to analyse from an external tool. The problem is that <a href='http://help.tradestation.com/08_08/elword/word/fileappend_reserved_word_.htm'>Fileappend</a> will be very slow operating, this is probably because Tradestation has only single command (its easy to handle) to Append and it probably does open and close by every single line and this requires time.</p>
<p>If we wanted export all Bar OHLC Data as external .csv file we need a code like seen:</p>
<pre class="brush: php; title: ; notranslate">
// code snipplet
OHLC=&quot;ohlc=O=&quot;+Numtostr(o,6)+&quot;;&quot;
		+&quot;H=&quot;+Numtostr(h,6)+&quot;;&quot;
		+&quot;L=&quot;+Numtostr(l,6)+&quot;;&quot;
		+&quot;C=&quot;+Numtostr(c,6)+&quot;;&quot;
		+&quot;DATE=&quot;+Numtostr(Date,0)+&quot;;&quot;
		+&quot;TIME=&quot;+Numtostr(TIME,0)+&quot;;&quot;		
		+&quot;VOLUME=&quot;+Numtostr(Volume,1)+&quot;;&quot;+Newline;

Fileappend(FN,OHLC);
</pre>
</p>
<p>
Exporting 1 Year of M1 Data contains around 726000 Bars in Tradestation (EURUSD), to export all these bars <a href='http://help.tradestation.com/08_08/elword/word/fileappend_reserved_word_.htm'>Fileappend()</a> needs 65 seconds to complete the operation (at least on my very fast computer with Flash/SSD Harddisk). If you need to export 10 years of data it would require over 12 minutes to complete, not very efficient.
</p>
<h2  id=underline>Solution Approach</h2>
<p>I have developed a library called <a href='/blog/files/fast_appender.dll'>fast_appender.dll</a>, this library is allowed to accept lines to append, it does not open, close by every single append operation. It opens the file and keeps appending until you say to close.</p>
<p>
The import is like seen:</p>
<pre class="brush: php; title: ; notranslate">
external: &quot;fast_appender.dll&quot;, string, &quot;faVersionA&quot;;  
external: &quot;fast_appender.dll&quot;, int, &quot;faInitA&quot;,LPSTR,int; 
external: &quot;fast_appender.dll&quot;, int, &quot;faAppendA&quot;,int,LPSTR; 
external: &quot;fast_appender.dll&quot;, int, &quot;faClose&quot;,int;
</pre>
</p>
<p>
I have made tests for both variants to append, with fileAppend native command of Easylanguage and FastAppender Library:<br />
<a href="https://fx1.net/blog/wp-content/uploads/2015/01/si.png"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/si-1024x388.png" alt="si" width="1024" height="388" class="alignnone size-large wp-image-2045" /></a></p>
<p>
As you see FastAppender is over 5 times faster in appending to text files. 5 times speed improvement is not something you should underestimate, there is huge difference between 5 seconds and 25 seconds per chart and symbol and exported file.
</p>
<h2  id=underline>FastAppender</h2>
<h4>int faInitA(string Filename,bool Append)</h4>
<p>This is first function you need to call and call it only once (once begin&#8230;.end block) at start. First parameter is name of file, second parameter accepts either 0 (false) or 1 (true), if you call it with 1, it will Append to existing file, if you call it with 0, it will Overwrite file and start Appending from first byte. This function returns a handle as int, you need to remember this handle, it will be reused in other commands</p>
<h4>int faAppendA(int Handle,string LineToAppend)</h4>
<p>This function will append LineToAppend to previously opened File, the Handle is taken from faInitA.</p>
<h4>int faClose(int Handle)</h4>
<p>This closes the handle, you will not need this function in Multicharts / Tradestation, you can need this function if you need to call from other platforms. Once you close the handle, you also close the file and you cannot Append anymore. If you are sure you will not append anymore, then you can close it.</p>
<h4>string faVersionA()</h4>
<p>Returns Version information of library.</p>
<h2  id=underline>Demonstration</h2>
<p>This example exports OHLC Data of all bars as .csv file</p>
<pre class="brush: php; title: ; notranslate">
Inputs: ExportDirectory(&quot;c:\DATA1\&quot;);
Vars: OHLC(&quot;&quot;),intrabarpersist FN(&quot;&quot;),BInterval(0),intrabarpersist fa(0);

// Import fast_appender
external: &quot;fast_appender.dll&quot;, string, &quot;faVersionA&quot;;  
external: &quot;fast_appender.dll&quot;, int, &quot;faInitA&quot;,LPSTR,int; 
external: &quot;fast_appender.dll&quot;, int, &quot;faAppendA&quot;,int,LPSTR; 
external: &quot;fast_appender.dll&quot;, int, &quot;faClose&quot;,int;

Once Begin
	if BarType=1 then BInterval=BarInterVal;
	if BarType=2 then BInterval=24*60; 
	if BarType=3 then BInterval=24*60*7;
	if BarType=4 then BInterval=24*60*30;
	If BarType=12 then BInterval=(Range/1 Point);	
	FN=ExportDirectory+getsymbolname+&quot;-&quot;+Numtostr(BInterval,0)+&quot;.csv&quot;;	
	// open File Handle and remember Handle in fa variable
	fa=faInitA(FN,1);  
end;

OHLC=&quot;ohlc=O=&quot;+Numtostr(o,6)+&quot;;&quot;
		+&quot;H=&quot;+Numtostr(h,6)+&quot;;&quot;
		+&quot;L=&quot;+Numtostr(l,6)+&quot;;&quot;
		+&quot;C=&quot;+Numtostr(c,6)+&quot;;&quot;
		+&quot;DATE=&quot;+Numtostr(Date,0)+&quot;;&quot;
		+&quot;TIME=&quot;+Numtostr(TIME,0)+&quot;;&quot;		
		+&quot;VOLUME=&quot;+Numtostr(Volume,1)+&quot;;&quot;+Newline;
 
if (fa&gt;0) then faAppendA(fa,OHLC);
</pre>
<h2>Download</h2>
<p>You can download it <a href='/blog/files/fast_appender.dll'>here</a></p>
<h2 id=underline>Final Words</h2>
<p>FastAppender library is working with threads, you submit the data which needs to be appended and it will do the actual work in background to ensure speed. This library is over 5x faster than native command. It replaces native Fileappend command completely, you can use it for all your Append, Export operations.Have fun using it</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/tradestations-slow-fileappend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
