Inputs StartTime, endtime  [SOLVED]

Questions about MultiCharts and user contributed studies.
KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Inputs StartTime, endtime

Postby KhaosTrader » 29 Aug 2012

when writing an signal I want to have two inputs:

inputs
StartTime(currenttime),
EndTime(CurrentTime);

but I I dont know how to set them to a default time, other than current time. So how would i make it like

StartTime(1000)
EndTime(1500)

I tried using the above but when I make an if statement

Code: Select all

if currenttime > StartTime or currenttime < EndTime then.....
It doesnt work because it doesnt know that Starttime and EndTime are times, it thinks they are just numbers..

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Inputs StartTime, endtime

Postby TJ » 29 Aug 2012

when writing an signal I want to have two inputs:

inputs
StartTime(currenttime),
EndTime(CurrentTime);

but I I dont know how to set them to a default time, other than current time. So how would i make it like

StartTime(1000)
EndTime(1500)

I tried using the above but when I make an if statement

Code: Select all

if currenttime > StartTime or currenttime < EndTime then.....
It doesnt work because it doesnt know that Starttime and EndTime are times, it thinks they are just numbers..
What is your chart resolution/ chart type?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Inputs StartTime, endtime

Postby TJ » 29 Aug 2012

maybe you need this

Code: Select all

if currenttime > StartTime AND currenttime < EndTime then.....

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: Inputs StartTime, endtime

Postby KhaosTrader » 29 Aug 2012

my question is not on how to write the logic, it is simply that I want to write an input variable that holds a time value that can have a default value.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Inputs StartTime, endtime

Postby TJ » 29 Aug 2012

my question is not on how to write the logic, it is simply that I want to write an input variable that holds a time value that can have a default value.
An input value is a value you decided to use for the calculation of your logic.

If you want the Start Time to be 10:00 am, and the End Time to be 3:00 m, then you declare the "input" as follows.

Code: Select all

inputs:
StartTime(1000),
EndTime(1500);
Your above declarations are correct. They should work.

KhaosTrader
Posts: 186
Joined: 10 May 2012
Has thanked: 14 times
Been thanked: 11 times

Re: Inputs StartTime, endtime  [SOLVED]

Postby KhaosTrader » 29 Aug 2012

Yes they work, somehow there was a logic error in my code. Thank you for your help :) Sorry I was a victim of my own bug.


Return to “MultiCharts”