How is a script (signal) calculated  [SOLVED]

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

How is a script (signal) calculated

Postby evdl » 02 Mar 2017

As far as I know, a new tick is triggering the signal to calculate.

What if the signal calculating is not done yet, and a new tick is coming in (fast markets). Will the signal start all over again and not finish the earlier triggered calculating?

So the question is: will the calculating of a signal be interrupted by a new incoming tick or does it finish all the code untill the end, before it will calculate again when a new tick is coming in.

I ask this because, when using "If (barstatus(1) = 2) and time = 900 then begin", sometimes does not trigger a trade in fast markets. So it looks like not all code to the end of the script is processed before a new tick is coming in.

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: How is a script (signal) calculated

Postby Angelina MultiСharts » 03 Mar 2017

Hello evdl,

The signal finishes the calculation for one tick before starting recalculation for a new one.

Do you print your strategy order generation?

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: How is a script (signal) calculated  [SOLVED]

Postby evdl » 03 Mar 2017

Hi Angelina,

I use printstatements to debug. It is hard to debug because it must happen realtime. Now I can rule out the possibility that script is interrupted before reaching the end of the script.

Thanks.

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: How is a script (signal) calculated

Postby Smoky » 05 Mar 2017

Code: Select all


Vars: intrabarpersist Enrg("") , intrabarpersist FileLog("TRD.csv"), intrabarpersist order(""), intrabarpersist dat(""), intrabarpersist heur("");


//first line of file
once begin
Enrg ="FLUX;DAT;HEUR;ORD;OPEN;HIGH;LOW;CLOSE";
print(file(Filelog),Enrg);
end;

//on every ticks
dat = DateBar();
heur = FormatTime("HH:mm:ss:ms",datetime);

Enrg = "BID;" + dat + ";" + heur +";" +order +";"+ numtostr(open data1,0) +";"+ numtostr(high data1,0) +";"+ numtostr(low data1,0) +";"+ numtostr(close data1,0) ;

print(file(Filelog),Enrg);

Code: Select all

//function DateBar();

Variables: dateInDateTime(0);

dateInDateTime = ELDateToDateTime(Date);

DateBar = FormatDate("yyyyMMdd",dateInDateTime);
use this code is better than print statement because print file is buffered and you realy have all in tick by tick ..
and you can read this file with Excel , or OpenOffice

don't worry EL is very speed, i run 1500 code lines in tick/tick without any problem LoL

hope this can help you to debug your script...

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: How is a script (signal) calculated

Postby evdl » 05 Mar 2017

Thanks Smoky,

deleted previous post, data error on the chart caused the issue with the trade not taken.


Return to “MultiCharts”