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
Objective
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.
Requirements
I am using SharedVar 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.
Get started
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.
I would like to post following code, this code is very basic to understand:
external: "SharedVar-a32.dll", int, "svInit" ,string; external: "SharedVar-a32.dll", bool, "svSetValue" ,int,string,double; external: "SharedVar-a32.dll", bool, "svSetString" ,int,string,string; external: "SharedVar-a32.dll", double, "svGetDouble" ,int,string; external: "SharedVar-a32.dll", string, "svGetString" ,int,string; external: "SharedVar-a32.dll", bool, "svServerStart"; 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("PerfectSystem"); atr=AvgTrueRange(14); end; svSetValue(sv,NumtoStr(Barnumber,0),Close); if(sv>=0) then begin tradeok=false; For qq=1 to maxbarsahead Begin Value1=getclose(qq); // check tp if (Value1>0 and Value1>Close+atr) then begin tradeok=true; break; end; // check sl if (Value1>0 and Value1<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);
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.
Why
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