How to postpone the order placement

Moderator: admin

How to postpone the order placement

Postby Karlo_Karlo » Thu Dec 10, 2015 3:26 am

I am looking for the way to place the order not right at the moment of the signal, but after some time,- say 60 seconds.

For instance:
...
if core.crossesOver(FastMA, SlowMA, period) then
-- Something is needed here to delay the order placement for 60 sec.
Open("S")
end

I would greatly appreciate the expert's 'help.

Thanks a lot. :)
Karlo_Karlo
Karlo_Karlo
 
Posts: 11
Joined: Fri Jan 07, 2011 4:48 am

Re: How to postpone the order placement

Postby Julia CJ » Fri Dec 11, 2015 3:29 am

Julia CJ
 

Re: How to postpone the order placement

Postby Karlo_Karlo » Fri Dec 11, 2015 8:14 am

Thank you JuliaCG,
I tried it but i need some examples of codes.
Karlo_Karlo
Karlo_Karlo
 
Posts: 11
Joined: Fri Jan 07, 2011 4:48 am

Re: How to postpone the order placement

Postby Julia CJ » Tue Dec 15, 2015 4:29 am

Hi Karlo,

There are examples of code:

local tid;

function Update(period, mode)
if ... then
tid = core.host:execute("setTimer", 1, 60);
end
end

function AsyncOperationFinished(cookie, success, message)
if cookie == 1 then
core.host:trace("1 minute has passed");
core.host:execute("killTimer", tid);
end
return 0;
end
Julia CJ
 


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 16 guests