<?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; admin</title>
	<atom:link href="https://fx1.net/blog/author/admin/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>StrategyQuant Ranking Selection</title>
		<link>https://fx1.net/blog/strategyquant-ranking-selection/</link>
		<comments>https://fx1.net/blog/strategyquant-ranking-selection/#comments</comments>
		<pubDate>Fri, 20 Feb 2015 17:50:36 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[quant]]></category>
		<category><![CDATA[strategyquant]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2121</guid>
		<description><![CDATA[Did you ever think what is the &#8220;best&#8221; ranking selection criteria in StrategyQuant to build your selected strategies? This is an essential question because StrategyQuant searches millions of strategies and [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Did you ever think what is the &#8220;best&#8221; ranking selection criteria in <a href='/strategy-quant.php'>StrategyQuant</a> to build your selected strategies? This is an essential question because StrategyQuant searches millions of strategies and ranks top x ordered by your ranking criteria. So imagine there might be 100k possible strategies profitable (Profit > 0) but only top x will be listed to choose from. You need to skills to pick right criteria and read the picture properly for success in trading. </h3>
<p><img src="https://fx1.net/blog/wp-content/uploads/2015/02/scrit.png" alt="scrit" width="400" height="544" class="alignleft size-full wp-image-2126" /></p>
<h2>Getting Started</h2>
<p>I have started a test which took me several days to determine and understand differences between ranking options. Of course you need to read about difference strategy selection criteria methods technically but i made following test:</p>
<p>I took very accurate Forex Data from Tradestation of single Symbol (GBPUSD) and let run <a href='/strategy-quant.php'>StrategyQuant</a> seveal times with different runtime and selection criteria. I have tested &#8220;Return / Drawdown ratio&#8221;,&#8221;System Quality Number score (Van Tharp + MF)&#8221;,&#8221;Net Profit&#8221; and &#8220;R Expectancy (Van Tharp)&#8221;. I have run them different lenght with same symbol, same data, same strategy settings, the only difference is the selection criteria. I have told Strategy Quant to save 4000 (instead of 500 by default) strategies and rank them for me. I have picked 4000 to have better statistical relevance and try to see differences.</p>
<p><H2>Objective</h2>
<p>1. I want to see if i get different strategies selected by changing the strategy selection criteria</p>
<p>2. I want to know how long i need to run Strategy Quant to have enough statictical relevant strategy pool. This is very important question for me.</p>
<p></br></br></p>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/02/sq12-e1424466553958.png"><img src="https://fx1.net/blog/wp-content/uploads/2015/02/sq12-e1424466553958.png" alt="sq1" width="400" height="381" class="alignleft size-full wp-image-2141" /></a></p>
<h2>Testing Criters</h2>
<p>I have run StrategyQuant over 2 full weeks and picked &#8220;return / drawdown ratio&#8221; as criteria and had at the end 4000 different strategies. I exported all 4000 as Pseudo Source Code into 4000 different .txt files and coded a parser in c# which has parsed &#8220;LongEntryCondition&#8221; which is the Entry condition and uniformed. How did i uniform them? I have simply removed all numbers. So if one strategy had &#8220;LongEntryCondition = Close Above Bollinger Bands(20, 2, 0)&#8221; and another had &#8220;LongEntryCondition = Close Above Bollinger Bands(12, 1, 0.5)&#8221;, by removing the number we get &#8220;LongEntryCondition = Close Above Bollinger Bands(, , )&#8221; which is uniformed. Then i have counted number of long conditions they have used same uniformed rule. If we check left screenshoot you see that &#8220;Short Term CCI()>&#8221; rule was used in 0 of strategies but &#8220;Hammer Candle Pattern&#8221; was used in 707 / 4000 strategies. </p>
<p></br></br></p>
<h2>Results</h2>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/02/sqresult.png"><img src="https://fx1.net/blog/wp-content/uploads/2015/02/sqresult.png" alt="sqresult" width="1823" height="699" class="alignleft size-full wp-image-2144" /></a>
</p>
<p>After spending weeks on this test i can clearly make several statements:</p>
<p>If you look at the big picture, selection criteria does not seems to have an effect. 4 Different selection criteria and 8 different runtime, we can see more or less similar long entry rules were taken and selected to be inside first 4000 and percentage of their weight in the 4000 is similar. I dont think we expect them to be exact same because we are using same data, setup but different selection criteria, they are roughly same.</p>
<p>If you look at &#8220;Return / DD (2 Weeks)&#8221; and &#8220;R Expectancy (VT) 15 + 32 hours&#8221; you see that red numbers (their relevance is very strong among 4000) are getting dominance. Why this might happen? I think this is a normal process, if you have pick 15 different indicators to choose from and in average they have 2.5 parameters and if we assume StrategyQuant picks the parameters randomly and if we assume the parameters value is in very rare cases over 100 and if we assume the resolution of parameters is by 1/100. 1 single indicator would have 100x100x2.5 different combinations =  25000 combinations. If we assume Strategy Quant uses 1..100 with resolution 1/100 to combine with single indicator, we can say 10000 combinations. If we assume SQ combines in average 2 indicators from 15 possible. There would be around 127 combinations x 10000 from static operations x 25000 from indicator we come to a combination of 31750000000. This calculation is too rough and does not reflect real nature of Strategy Quant, i am just playing the numbers to demonstrate the reason why long lasting searches end with &#8220;red&#8221; numbers&#8230;.</p>
<p>In case of first test which took 2 weeks, we can assume that millions of strategies were tested. I have tested everything with Random Evaluation method, which means everything is random. Imagine if you run same test over 2 weeks and millions of iterations are over, the possibility that you will find very similar straties with similar criters. Imagine you have found &#8220;LongEntryCondition = Close Above Bollinger Bands(20, 2, 0)&#8221; and &#8220;LongEntryCondition = Close Above Bollinger Bands(20, 2, 0.1)&#8221; and &#8220;LongEntryCondition = Close Above Bollinger Bands(20, 2, 0.2)&#8221; and if exit is similar the results will be very similar, this again results that our selection criteria will also have very similar number. As example first strategy has &#8220;return / dd ratio&#8221; 3.04 and other one 3.05 and other 3.03. It is obvious they will be listed together. </p>
<h2>Conclusion</h2>
<p>1. Strategy Quant will list very similar strategies together and if you run it over months, results will be piled up with very similar entry rules. Is this what we want? I dont think so, we try to find strategies they are different. My recommendation is: do not run Strategy quant too long time, I have decided to stop random search after 20-30 hours from start and do evaluation. I have found this is a good time to look for results, otherwise results will piled up and you get only few different strategy ideas</p>
<p>2. I think that there is no perfect strategy selection criteria, this is a bit matter of sense and trust. My tests show that almost all 4 different criters came to similar hotspots with long entries. (see screenshoot and colored cells). I have run &#8220;return / dd&#8221; intentionally too long, i am almost sure if i ran it only 2 days, i would have similar results like others. </p>
<p>3. You can download the <a href='/files/sqworkbook.xls'>Workfile in Excel format</a> and analyse it yourself&#8230; From 698 different long entry strategies top 20 in excel has bigger presence in the list. I assume if a long entry criter has less then 10 strategies from 4000, i assume this long criter might not be very relevant! That is the idea why i have started making these tests. I wanted find hotspots. I believe hotspots can help you to identify edge. For example in our chart, &#8220;Dark Cloud Candle Pattern&#8221; has strong relevance on almost all different criters. I can say that i can pick 1 of these 200-400 strategies they contain &#8220;Dark Cloud Candle Pattern&#8221; and trust it. Of course it is different story which one of these 200-400 is to pick, this requires another big blog entry. Pick the one with your favorite criters, there is not a simple way to pick.</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/strategyquant-ranking-selection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Draw History Trades to MT4 Chart</title>
		<link>https://fx1.net/blog/draw-history-trades-to-mt4-chart/</link>
		<comments>https://fx1.net/blog/draw-history-trades-to-mt4-chart/#comments</comments>
		<pubDate>Mon, 12 Jan 2015 11:54:29 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[draw]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[mql]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2107</guid>
		<description><![CDATA[To evaluate someones trading style, its important to see trades visually on chart. Services such as myfxbook or signalauditor does very good analyse of trades and their metrics but to [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>To evaluate someones trading style, its important to see trades visually on chart. Services such as myfxbook or signalauditor does very good analyse of trades and their metrics but to see trades visually gives you other perspective!</h3>
<h2>Objective</h2>
<p>We want to write an indicator which can draw all our history trades from current account to chart. This indicator will draw EURUSD History Trades to EURUSD Chart, it will filter Symbols automatically. Beside this you can filter trades by their MAGICNUMBER or/and Comments (by Input parameters). filterMAGIC input parameters needs to be -1 if you want include all trades. filterComment needs to be empty string to include all trades, otherwise specifify substring of comment or Magicnumber of trades you want to have displayed</p>
<h2>Screenshoots</h2>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/01/history1.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/history1-1024x453.jpg" alt="history1" width="1024" height="453" class="alignnone size-large wp-image-2110" /></a></p>
<p><a href="https://fx1.net/blog/wp-content/uploads/2015/01/history2.jpg"><img src="https://fx1.net/blog/wp-content/uploads/2015/01/history2-1024x453.jpg" alt="history2" width="1024" height="453" class="alignnone size-large wp-image-2111" /></a></p>
<h2>Source code</h2>
<p>
Basic MQL Code is:</p>
<pre class="brush: php; title: ; notranslate">
#property copyright &quot;Fx1 Inc, 2015&quot;
#property link      &quot;Fx1.net&quot;
#property version   &quot;1.00&quot;
#property strict
#property indicator_chart_window

extern   int      filterMAGIC=-1; 
extern   string   filterComment=&quot;&quot;;
extern   color    BuyColor = Gold;
extern   color    SellColor = Tomato;

int   OnInit() { ObjectsDeleteAll(0,0,OBJ_TREND);   return(INIT_SUCCEEDED);  }
void  OnDeinit(const int reason)  { ObjectsDeleteAll(0,0,OBJ_TREND); }

int LastBar=-1;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &amp;time[],
                const double &amp;open[],
                const double &amp;high[],
                const double &amp;low[],
                const double &amp;close[],
                const long &amp;tick_volume[],
                const long &amp;volume[],
                const int &amp;spread[])
  {

   if (Time[1]!=LastBar)
   {
      for(int i=0;i&lt;OrdersHistoryTotal();i++)
         {
         if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
         if (OrderSymbol()==Symbol())
         if (filterMAGIC&lt;0 || OrderMagicNumber()==filterMAGIC)
         if (filterComment==&quot;&quot; || StringFind(OrderComment(),filterComment)&gt;-1)
            {
               while (!DrawTrade(OrderTicket())) {}
            }
         }
      LastBar=Time[1];      
  }

   return(rates_total);
}





bool DrawTrade(int Ticket)
{
if (OrderSelect(Ticket,SELECT_BY_TICKET,MODE_HISTORY))
     {         
      string nam=&quot;DrawnTrade_&quot;+DoubleToStr(Ticket,0);          
      if(!ObjectCreate(0,nam,OBJ_TREND,0,OrderOpenTime(),OrderOpenPrice(),OrderCloseTime(),OrderClosePrice()))
        {            
        ObjectSet(nam, OBJPROP_RAY, 0);
        ObjectSet(nam, OBJPROP_COLOR, OrderType()==OP_BUY ? BuyColor : SellColor);
        ObjectSet(nam, OBJPROP_WIDTH, 3);            
        return(true);
        }      
        else{
        return(false);
        }    
     }
return(true);
}
</pre>
<p>This is a Metatrader4 Indicator code, simply copy&#038;paste it into your Metaeditor as Indicator and you are done, for lazy people download it from <a href='/blog/files/fx1.DrawHistoryTrades.mq4'>here</a></p>
</p>
<h2>Comments</h2>
<p>This small code will give you insight about trading style. I am using this code with Investor Password on my Trading Terminal to analyse trades from friends or even myself. This feature needs to be implemented into Metatrader natively. Enjoy using it.</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/draw-history-trades-to-mt4-chart/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>Put any Image with mt4gui</title>
		<link>https://fx1.net/blog/put-any-image-with-mt4gui/</link>
		<comments>https://fx1.net/blog/put-any-image-with-mt4gui/#comments</comments>
		<pubDate>Fri, 09 Jan 2015 07:05:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[mt4gui]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[mql]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=2063</guid>
		<description><![CDATA[Do you want to put your logo as image and impress your clients with your programming-skills? Mt4gui is perfect tool to master this Requirements We assume you use mt4gui framework, [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>Do you want to put your logo as image and impress your clients with your programming-skills? Mt4gui is perfect tool to master this</h3>
<h2>Requirements</h2>
<p>
We assume you use <a href='http://mt4gui.com'>mt4gui framework</a>, assume you understand basic concepts of this framework, if not give it a try. Mt4gui is a library which can use MQL Developers have button, checkbox, radiobox, image, label etc on their charts and capture those events such as clicked.
</p>
<h2>Requirements</h2>
<p>
There are few requirements with this approach:</br></p>
<ol>
<li>image needs to have BITMAP (.bmp) format</li>
<li>image cannot be transparent and they will cover underlying ohlc chart, i don´t recommend huge images </li>
<li>image needs to be present inside Terminal folder where terminal.exe is inside, if you want to deploy it to your clients, you need to make sure you copy the .bmp file into terminal folder with installer software. Of course you could also tell your clients to put the .bmp file into this folder but if we assume most of clients are novice, it might end up by a mess. I recommend to use a software such as <a href='https://fx1.net/easetup.php'>EASetup</a> to install Metatrader clients.</li>
<li>Images does not have any events. So you cannot detect a clicked event for example</li>
</ol>
<p/>
<h2>Howto</h2>
<p>
Very basic MQL code is:</p>
<pre class="brush: php; title: ; notranslate">
#include &lt;mt4gui2.mqh&gt;

int hwnd,image1;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,&quot;image&quot;,100,100,0,0,&quot;fx1logo.bmp&quot;);
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd&gt;0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick()
{  
 // ..... your code ....
}
</pre>
</p>
<p>
Result:<br />
<img src="https://fx1.net/blog/wp-content/uploads/2015/01/mt4guiimage.bmp" alt="mt4guiimage" width="970" height="327" class="alignnone size-full wp-image-2071" />
</p>
<h2>Easy World</h2>
<p>
It is very easy to add images with mt4gui. You can display your logo for few seconds and then remove it with guiRemove(hwnd,image1) command simply and it is gone. The dimentions of bmp file will be applied automatically, you dont need to know the dimentions, just the location.
</p>
<h2>Lets go more advanced</h2>
<p><iframe width="860" height="455" src="//www.youtube.com/embed/srODOeYNQf0" frameborder="0" allowfullscreen></iframe></p>
<p>Code is easier than you think</p>
<pre class="brush: php; title: ; notranslate">
#include &lt;mt4gui2.mqh&gt;

int hwnd,image1,xpos=100;

int OnInit()
{
  hwnd = WindowHandle(Symbol(),Period());	
  guiRemoveAll(hwnd);		
  image1 = guiAdd(hwnd,&quot;image&quot;,xpos,100,0,0,&quot;train.bmp&quot;);  
  EventSetMillisecondTimer(10);
  return(INIT_SUCCEEDED);
}

int deinit()
{
  // Very important to cleanup and remove all gui items from chart   
  if (hwnd&gt;0) guiRemoveAll(hwnd);  
  guiCleanup(hwnd); 
  return(0);
}
  
void OnTick() {  }

void OnTimer()
{  
 long width;
 if (ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0,width))
 {
   guiSetPos(hwnd,image1,xpos++,100);
   if (xpos&gt;width) xpos=0;
 } 
}
</pre>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/put-any-image-with-mt4gui/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>
		<item>
		<title>iCustom Indicator with MQLLock</title>
		<link>https://fx1.net/blog/icustom-indicator-with-mqllock/</link>
		<comments>https://fx1.net/blog/icustom-indicator-with-mqllock/#comments</comments>
		<pubDate>Fri, 02 Jan 2015 08:56:51 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[Mqllock]]></category>
		<category><![CDATA[icustom]]></category>
		<category><![CDATA[mql]]></category>
		<category><![CDATA[mqllock]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=1997</guid>
		<description><![CDATA[I was asked if a mqllock protected indicator can be loaded with iCustom from another Strategy or Indicator which is not protected.. Setup for Test I have taken ForceIndex Indicator [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>I was asked if a mqllock protected indicator can be loaded with iCustom from another Strategy or Indicator which is not protected..</h3>
<h2 id=underline>Setup for Test</h2>
<p>I have taken <a href='http://ta.mql4.com/indicators/oscillators/force_index'>ForceIndex</a> Indicator to get started, then submitted it to mqllock using <a href='https://mqllock.com/start/'>https://mqllock.com/start/</a> and after several minutes i had a protected version. I have installed Protected version to my computer and applied both (protected and original to chart to see if it works after protection)</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2015/01/forceindex.png" alt="forceindex" width="846" height="500" class="alignnone size-full wp-image-2001" /></p>
<p>All seems to work well so far with open license. Now its time to write a test mql code like seen:</p>
<pre class="brush: php; title: ; notranslate">
void OnTick()
{

   // Original Indicator with iCustom
   double Ret1 = iCustom(Symbol(),Period(),&quot;ForceIndex&quot;,13,0,0,0,0);   
   // Protected Indicator with iCustom
   double Ret2 = iCustom(Symbol(),Period(),&quot;MQLLock_5200_ForceIndex_rev1&quot;,13,0,0,0,0);
   
   // Output
   Print(&quot;Original = &quot;+DoubleToStr(Ret1,2)+&quot; Protected = &quot;+DoubleToStr(Ret2,2));      
}
</pre>
<p>As you see i am calling original indicator with iCustom and Protected one with iCustom. <a href='http://docs.mql4.com/indicators/icustom'>Manual page for iCustom</a> is very well written and worth to check.
</p>
<h2  id=underline>It works!</h2>
<p>The results are very well like seen here on output; Original called iCustom values are exactly same as Protected version:
</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2015/01/to-1024x254.png" alt="to" width="700" height="174" class="alignnone size-large wp-image-2004" /></p>
<p>I have tried same with Account Number Licensing, it has worked too same good. As last test i have removed the license on mqllock administration panel and restarted the Metatrader4 Terminal, it has closed the terminal with insufficient license error! All works perfectly. </p>
<h2  id=underline>Conclusion</h2>
<p>MQLLock protected indicators applied to chart or called from iCustom works perfectly. No issues at all. All Features are compatible. Enjoy it</p>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/icustom-indicator-with-mqllock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hassle with mql5.com Trading Signal Subscription</title>
		<link>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/</link>
		<comments>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/#comments</comments>
		<pubDate>Mon, 29 Dec 2014 15:17:43 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[MQL]]></category>
		<category><![CDATA[Signals]]></category>
		<category><![CDATA[mql]]></category>
		<category><![CDATA[mql5.com]]></category>
		<category><![CDATA[Signal]]></category>
		<category><![CDATA[SignalSubscriber]]></category>

		<guid isPermaLink="false">https://fx1.net/blog/?p=1958</guid>
		<description><![CDATA[This post is about problems on mql5.com site to subscribe signals. I will also introduce how to solve these problems MT4 Terminal requires Signal Search Feature There are around 2000 [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3>This post is about problems on mql5.com site to subscribe signals. I will also introduce how to solve these problems</h3>
<h2 id=underline>MT4 Terminal requires Signal Search Feature</h2>
<p>
There are around 2000 Signals in mql5.com Signal Database for MT4. Imagine you have found a &#8220;good&#8221; signal and want to subscribe to it from your terminal. You can click to Subscribe button on web and your browser will open MT4 Terminal with request to subscribe. But imagine if you have multiple MT4 Terminals installed (most of us have done) then your browser will open always same browser (usually first of last installed Terminal).
</p>
<p>
You may try to search the signal from Signals Tab inside MT4 Terminal. The problem here is that you cannot find your signal easly among thousands of signals! Metatrader4 definetly needs a search signal feature.
</p>
<p><img src="https://fx1.net/blog/wp-content/uploads/2014/12/SignalOnMt4-1024x198.jpg" alt="SignalOnMt4" width="700" height="135" class="alignnone size-large wp-image-1969" /></p>
<p>
I have also tried to Subscribe to Signals with MQL Script. Since Build > 620 they have introduced <a href='http://docs.mql4.com/signals'>&#8220;Trade Signal Commands&#8221;</a>, they look very promising at first sight. I have tried following code:
</p>
<pre class="brush: php; title: ; notranslate">
void OnStart()
  {
  int total=SignalBaseTotal();
  long signalid = 74156;
//--- process all signals
   for(int i=0;i&lt;total;i++)
     {
      //--- select the signal by index
      if(SignalBaseSelect(i))
        {
         //--- get signal properties
         long   id    =SignalBaseGetInteger(SIGNAL_BASE_ID);          // signal id
         long   pips  =SignalBaseGetInteger(SIGNAL_BASE_PIPS);        // profit in pips
         long   subscr=SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS); // number of subscribers
         string name  =SignalBaseGetString(SIGNAL_BASE_NAME);         // signal name
         double price =SignalBaseGetDouble(SIGNAL_BASE_PRICE);        // signal price
         //--- print all profitable free signals with subscribers
         if(price==0.0 &amp;&amp; pips&gt;0 &amp;&amp; subscr&gt;0)
            PrintFormat(&quot;id=%d, name=\&quot;%s\&quot;, pips=%d, subscribers=%d&quot;,id,name,pips,subscr);
        }
      else PrintFormat(&quot;Error in call of SignalBaseSelect. Error code=%d&quot;,GetLastError());
     }
  ResetLastError();
  if (SignalSubscribe(signalid))
  {
   Print(&quot;Success&quot;);
  }
  else 
  {
   Print(&quot;Error : &quot;+GetLastError());
  }
  }</pre>
<p>
Result: it throw me around 120 signals out of 2000 available. Different brokers deliver different signals. Moreover SignalSubscribe() command fails with 4060 error if you run it as Script(Operation not permitted). For more details about this problem i have opened a <a href='https://www.mql5.com/en/forum/38736'>forum thread</a>. Update: Signalsubscribe seems to work as Expert Advisor but i think its too insecure to be able to subscribe to signals from an Expert Advisor. To subscribe to any signal you would need to enter SignalID as external parameter and EA would subscribe for you.
</p>
<p>
Conclusion: It is not easy to subscribe in multi mt4 environment to pre-choosen signal providers feed without external tools. I really hope that Metaquotes implements search functionality into MT4.
</p>
<h2  id=underline>Find SignalID</h2>
<p>
SignalID is an unique identified which is assigned to every unique signal at mql5.com site. SignalID is usually carried in URL to load signals. For example; the Signal &#8216;Lol&#8217; has SignalID 47702, we can read this from url <a href='https://www.mql5.com/en/signals/47702'>https://www.mql5.com/en/signals/<span style='background: orange; color: black'>47702</a></a>. Of course you could use <a href='http://docs.mql4.com/signals'>Signal Enumerating functions</a> to find your Signal and use
<pre>long   id    =SignalBaseGetInteger(SIGNAL_BASE_ID);</pre>
<p> to search the Identified, but as i mentioned this function is not working properly (probably not yet)
</p>
<h2  id=underline>Manual Approach</h2>
<p>
You can initiate a subscription with Parameters sent to MT4 Terminal easly. Here is how:
</p>
<ol style='border-left: 3px solid orange; padding-left: 50px; margin-left: 15px'>
<li>Make sure your MT4 Terminal you want to start subscription is logged in with your mql5.com credentials &#038; has enough credit on account, deposit more, if you don´t</li>
<li>You open Command Line Interface (cmd.exe) </li>
<li>Go into the folder with cd command </li>
<li>type
<pre>terminal.exe "mql4buy://signal/subscribe/12345.fx1"</pre>
<p> and press Enter. You replace 12345 with your favorite SignalID.<br />
<img src="https://fx1.net/blog/wp-content/uploads/2014/12/subscribemanual.jpg" alt="subscribemanual" width="674" height="176" class="alignnone size-full wp-image-1977" /></li>
<li>Wait several seconds, your terminal will popup with Subscribe confirmation dialog</li>
</ol>
<h2  id=underline>Automatic: SignalSubscriber</h2>
<p>
I have written small utility for myself you can type SignalID and select Terminal to subscribe and it will start subscription dialog with Terminal automatically. This tool does not automate all process, you still need to confirm subscription with your mql5.com login. You will also need a Terminal which supports Signals and enough credit.<br />
<img src="https://fx1.net/blog/wp-content/uploads/2014/12/autosubscribe.jpg" alt="autosubscribe" width="578" height="444" class="alignnone size-full wp-image-1991" /><br />
You can download this tool <a href='/blog/files/SignalSubscriber.exe'>here</a>
</p>
<p>
I am using SignalSubscriber tool myself and so far very nice tool, it helps me to subscribe signals rapidly.
</p>
<h3>Hope to have helped to save you guys time &#038; money</h3>
]]></content:encoded>
			<wfw:commentRss>https://fx1.net/blog/hassle-with-mql5-com-trading-signal-subscription/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
