How to make a strategy skip 1 candle before reopening a pos?

Moderator: admin

How to make a strategy skip 1 candle before reopening a pos?

Postby ilnefopas » Thu Dec 08, 2016 3:48 am

Hi guys,

When a trade gets closed, I'd like my strategy to wait 1 "Timeframe period" before opening a new position.
To achieve that on the the 5 minutes for instance, I created a timer that waits for 5 minutes when a trade gets closed but TSII doesn't like this way of doing things. Indeed TSII detects when a strategy "loops" for more than 30 secs, sees that as an error and pauses the strategy.
Does anyone has a "good way" of doing that without making the strategy wait, meaning just "skip" 1 candle ?

Thanks,
Ben.
ilnefopas
 
Posts: 26
Joined: Mon Dec 28, 2015 12:51 pm

Re: How to make a strategy skip 1 candle before reopening a

Postby Apprentice » Sun Dec 18, 2016 11:25 am

U can use something like this
now = core.host:execute("getServerTime");
CoolDownTime= now + (CoolDownInterval / 86400.0)))

if now < CoolDownTime then
return;
end
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 10 guests