Strategy start at 7AM local time

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Strategy start at 7AM local time

Postby conjure » Tue Feb 13, 2018 12:34 pm

Hi.
I m trying to make my own strategy and i want the strategy to check the current state of the last candle at 7 am local time on DAY chart.i Know that source.close( 0 ) is wrong.
How can i do it?
Can someone help me on that?


Code: Select all
source.close( 0 )>source.close( 1 ) .and. source.close( 1 )>source.close( 2 )
.and. source.close( 2 )>source.close( 3 )  .and. source.close( 3 )<source.close( 4 )


conjure
 
Posts: 85
Joined: Sat Jul 22, 2017 7:27 am

Re: Strategy start at 7AM local time

Postby Apprentice » Fri Feb 16, 2018 7:44 am

--for the current (last) candle use
source.close[ period]
--for the candle before the last use
source.close[ period-1]

--and so on...

--or u can use
--for the current (last) candle use
source.close[ source:size()-1]
--for the candle before the last use
source.close[ source:size()-1-1]

--and so on...


--or u can use
local Last=source:size()-1;
--for the current (last) candle use
source.close[ Last]
--for the candle before the last use
source.close[Last-1]

--and so on...
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 19568
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 9 guests