Not sure what exactly you want, but below is a simple buy rule that buy when bid price crosses up the MA (x).
PriceBid < MA (x) Previous
AND PriceBid > MA (x) Current
A crossover. That's a part of the problem. But not even really needed.
The 1st buy will indeed be when a price crosses above the MA. (if a gap is also seen as a crossover)
But opening above the MA is also a buy.
But there will be only 1 buy per day. Bouncing prices could trigger a buy 10 times a day.
So simply put I want the following:
If price>MA AND First_Trade_of_the_day = TRUE THEN buy.
Other question.
Am I allowed to ask a ton of coding questions on this board?
Or is it more for exchanging trading ideas.
If yes then maybe a seperate forum could keep other sections less poluted.
I need get some help to get started with the MT4 code.
ATM it's a bit over my head. MT4 is spaghetti code. I'm more the type of person that splits things up in subrountines.
Hey,
That's simple. Just add TimeDay(LastTradeTime) Day
If you want X seconds of interval between each trade, you can simply add CurTime - LastTradeTime => X
Hey 7,
Don't hesitate to ask a ton of questions. You can even ask a million tons of questions! But be sure you categorize it in proper forum. However, I've seen you putting all threads properly already.
I'm not so sure this question is in the right forum. It has nothing to do with ZeroCode and doesn't fit elswhere either.
---
On other platforms an MA simply plots by typing MA(some vars here)
In MT4 most people recode an MA thats hardcoded in MT4 already.
And even if the standard MA is used I see all kind of loops to plot it.
So my question is:
I want an example of the absolute minimum to plot a MA
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to open a position if the price crosses an MA. (Buy)
But once the position is open I want to add to that position if the opening price is still above the MA.
That gives me 2 problems.
a] How to enter 2 'buy types' in ZeroCode and making sure they are executed in the right order.
b] During the day MT checks that rule a million times. If the price stays above the MA that would mean a million buys.
My account is to small for such large positions
Is it possible in ZeroCode?