Easylanguage code help

Peyt71

Newbie
Messages
3
Likes
0
Hello everyone, I'm a beginner in coding and currently working on creating a time loop in EasyLanguage. I've included the code below, but I'm encountering an error on line 22 (MinuteOfHour).
If anyone can provide assistance with this issue, I would greatly appreciate it.

Inputs:
LinePriceGreen(500.00), // New variable for Long entry
LinePriceRed(300.00), // New variable for Short entry
Tick2(.50);

Variables:
BarBackNo(0),
LongPrice(0),
ShortPrice(0),
BuyCondition(false),
ShortCondition(false),
CurrentTime(0);

For BarBackNo = 0 To 9
Begin
LongPrice = Close;
ShortPrice = Close;

// Check if the minute part of the time is divisible by 5
CurrentTime = Time[BarBackNo];

if MinuteOfHour(CurrentTime) mod 5 = 0 then // Check if time is divisible by 5
Begin
// Buy condition
if LongPrice - LinePriceGreen > Tick2 then
BuyCondition = true;

// Sell Short condition
if ShortPrice - LinePriceRed > Tick2 then
ShortCondition = true;
End;
End;

// Place orders outside the loop based on conditions
if BuyCondition then
Buy next bar at market;
if ShortCondition then
Sell Short next bar at market;
 
Hello everyone, I'm a beginner in coding and currently working on creating a time loop in EasyLanguage. I've included the code below, but I'm encountering an error on line 22 (MinuteOfHour).
...
if MinuteOfHour(CurrentTime) mod 5 = 0 then // Check if time is divisible by 5
Try changing
"if MinuteOfHour(CurrentTime) mod 5 = 0"
to
"if TimeToMinutes(CurrentTime) mod 5 = 0"

 
Last edited:
Try changing
"if MinuteOfHour(CurrentTime) mod 5 = 0"
to
"if TimeToMinutes(CurrentTime) mod 5 = 0"

Thanks for your reply but that did not work either.
I tried posting it to Easylanguage's forum and this is the response I got :

You may access date time properties such as Minute of the BarDateTime of a bar, please see a code example below:
variables:
BarTimeMinute( 0 );

BarTimeMinute = BarDateTime.Minute;

print( BarDateTime.ToString(), " ", BarTimeMinute );

Can you help me fix it based on this info?
Thanks in advance
 
Top