Reply

Coding Questins

4 replies

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

8 years ago #110895

Few questions I have come across:

1. I want to enter when MA is acting as support. So I want to buy when a bullish candle formation occurs within x number of pips of the MA. How can I code this in EA Wizard? I htought about "Close" < MA+ConverttoRealPips(parameter that is 5), but I was did not know if this was correct. Here is the code I have so far:

2. I want to limit trading by a start time and an end time. Am I doing it correctly?

Paremeters:

Code:

3. I noticed on the example EA's that the code always included "Is Bar Open is True". Does this need to be in every EA – it is what starts the logic pattern?

Thank you, Mark!

-Stearno

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

8 years ago #120905

1. I want to enter when MA is acting as support. So I want to buy when a bullish candle formation occurs within x number of pips of the MA. How can I code this in EA Wizard? I htought about “Close” < MA+ConverttoRealPips(parameter that is 5), but I was did not know if this was correct. Here is the code I have so far:

the condition [b]Close < MA+ConverttoRealPips(5)[/b] will be true if Close price is lower than value of MA + 5 pips, it is probably what you want to achieve.

2. I want to limit trading by a start time and an end time. Am I doing it correctly?

no, you have two mistakes there:
– the time parameters cannot be given as a string – like 08:00. You have to split them to hour and minute (or only use hour part if minute will be always 0).
So your parameters shoudl be:
StartTime1 int 8
EndTime1 int 16
StartTime2 int 14
EndTime2 int 17

– then in the condition you can either use Hour[0] > StartTime1
or if you want to use Time[0] then youhave to use function GetTime() on the other side of comparison, like
Time[0] > GetTime(StartTime1, 0, 0)
and
Time[0] < GetTime(EndTime1, 0, 0)

3. I noticed on the example EA’s that the code always included “Is Bar Open is True”. Does this need to be in every EA – it is what starts the logic pattern?

yes, every EA contains preparation for the use of this variable, but it is not used unless you use it inn your trading rule.

Mark
StrategyQuant architect

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

8 years ago #120910

Thanks, Mark! On, the limitation of trading by hour: if I say 6 in the StartTime1 field and say >, then that means it would start trading at 7. So if I want it to start at trading at 0600, then I should use >=, correct?

Lastly, do I use 6 or 06? It appears by your answer above, I use 6 but wanted to be sure.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

8 years ago #120918

Thanks, Mark! On, the limitation of trading by hour: if I say 6 in the StartTime1 field and say >, then that means it would start trading at 7. So if I want it to start at trading at 0600, then I should use >=, correct?

Lastly, do I use 6 or 06? It appears by your answer above, I use 6 but wanted to be sure.

yes, if you want to start at 6 you should use Hour[0] >= 6

You should use 6, it is a number, not text

Mark

Mark
StrategyQuant architect

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

8 years ago #120925

Thanks, Mark.

0

Viewing 5 posts - 1 through 5 (of 5 total)