Forex Factory
  • Home
  • Forums
  • News
  • Market
  • Login
  • User/Email: Password:
  • 5:50am
  • Search
Menu
  • Forums
  • News
  • Market
  • Login
  • 5:50am
Search

Options

Search

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

Similar Threads

Mql4 Coding Help 12 replies

MT4 Draw Symbol instead of Arrow, Draw n instead of square 2 replies

MQL4 Coding and Fractal EA for you 13 replies

MQL4 Language Most Recent Version is it updated beyond the tutorial on the mql4 websi 6 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 4
Attachments: MQL4 coding to draw lines
Exit Attachments

MQL4 coding to draw lines

  • Post #1
  • Quote
  • First Post: Jun 23, 2018 9:33pm Jun 23, 2018 9:33pm
  •  crackmyback
  • | Joined Mar 2011 | Status: Member | 24 Posts
Hey all!

So I'm rather new to coding and am trying to write an EA/Script/Indicator (whichever will do the job) to draw a vertical line on a selected chart at all points where a certain condition is met. At this point it's pretty basic i.e. draw a vertical line if the close-price of a particular bar is below the 90-candle moving average (of candle close price) AT THAT BAR. Once I get that to work, I can add more conditions and develop the indicator further. Here's what I have so far:

void OnTick()
{
datetime time = iTime(NULL,NULL,0);
if (PRICE_CLOSE < iMA(NULL,0,90,0,0,PRICE_CLOSE,0))
ObjectCreate("Line" + time,OBJ_VLINE,0,time,0,0);
}

Problem is, it starts with a bar where that condition is true, and KEEPS DOING THAT FOR ALL SUBSEQUENT BARS - EVEN IF THE 90-period moving average > close price later.

I know that the current form of the code may draw a line at all bars where the condition is true and not just the bar where the condition BECOMES true - and that's something I hope to address too (and something I need help with), but if I'm not mistaken, isn't that a separate issue from what's happening with the code above?

Also, would it be better to write a script or an EA or a CI for this?

Like I said, I'm a rookie coder so ANY help would be much appreciated.

Thanks!
  • Post #2
  • Quote
  • Jun 24, 2018 2:26am Jun 24, 2018 2:26am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
It would be an Indi as you are not trading from it.
EA is needed if you need to trade from the signals.

Just add an extra condition to stop line on subsequent bars .....

if (Close[i+1] < iMA(NULL,0,90,0,0,PRICE_CLOSE,i+1) &&
Close[i+2] >= iMA(NULL,0,90,0,0,PRICE_CLOSE,i+2))

where 'i' is the counter in a loop which checks each bar.

HTH

M.
If you think I'm mad, I must be mad
  • Post #3
  • Quote
  • Jun 26, 2018 6:41pm Jun 26, 2018 6:41pm
  •  crackmyback
  • | Joined Mar 2011 | Status: Member | 24 Posts
Hey thanks!
  • Post #4
  • Quote
  • Jun 27, 2018 10:41am Jun 27, 2018 10:41am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
If you think I'm mad, I must be mad
  • Post #5
  • Quote
  • Jun 28, 2018 11:28am Jun 28, 2018 11:28am
  •  krisegale
  • | Joined Feb 2015 | Status: Member | 11 Posts
Quoting futurespec
Disliked
Ignored
Hello Futurespec,
Please I know you are very busy. But I need your help. Please can you help me modify an EA by adding Multi Pairs whereby you insert the EA in one pair and it affect other currencies. The entry will be based on the indicator in the EA. Also, the targetprofit will close all the trade pairs in Profit.
I will appreciate your reply and help.
Thanks
Attached File
File Type: mq4 sell&buy242-02_Mod5A.mq4   23 KB | 167 downloads
  • Post #6
  • Quote
  • Jun 29, 2018 4:17am Jun 29, 2018 4:17am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Hi krisgale,
Sorry but cannot take on jobs like that without payment.
Occasionally if I am doing nothing I will do odd simple jobs for free to help people BUT if I answered all requests I would be inundated.

Hope you understand.

M.
If you think I'm mad, I must be mad
  • Post #7
  • Quote
  • Jun 29, 2018 5:37am Jun 29, 2018 5:37am
  •  krisegale
  • | Joined Feb 2015 | Status: Member | 11 Posts
I appreciate your reply. I was impressed about your fair kindness people were commenting about programming. If you want me to pay for the service; no problem. I saw Multi-currency EA you contributed by modifying. Everybody appreciated your work in the EA. I demo the EA and noticed some lapses which I will want you to improve on it.

1) The EA entry is stagnant. You have to change 0,1 or -1 manually before it can buy or sell or no trade; which suppose not to be so. I will like you to add MA (period, method and price) to buy or sell (Entry logic). That is, let the EA depend on the MA to buy or sell for each currency pair.

2) I want you to add an Lot Exponent and PipStep visible in the external tick.

All other function remains. How much will it cost to do this?
Will appreciate your quick reply.
Thanks
  • Post #8
  • Quote
  • Jun 29, 2018 5:55am Jun 29, 2018 5:55am
  •  krisegale
  • | Joined Feb 2015 | Status: Member | 11 Posts
Quoting futurespec
Disliked
Hi krisgale, Sorry but cannot take on jobs like that without payment. Occasionally if I am doing nothing I will do odd simple jobs for free to help people BUT if I answered all requests I would be inundated. Hope you understand. M.
Ignored
Hello futurespec,

We appreciate your reply. I was impressed about your fair kindness people were commenting about programming. If you want me to pay for the service; no problem. I saw Multi-currency EA you contributed by modifying. Everybody appreciated your work in the EA. I demo the EA and noticed some lapses which I will want you to improve on it.
1) The EA entry is stagnant. You have to change 0,1 or -1 manually before it can buy or sell or no trade; which suppose not to be so. I will like you to add MA (period, method and price) to buy or sell (Entry logic). That is, let the EA depend on the MA to buy or sell for each currency pair.
2) I want you to add an Lot Exponent and PipStep visible in the external tick.
All other function remains. How much will it cost to do this?
Will appreciate your quick reply.
Thanks
  • Post #9
  • Quote
  • Jun 29, 2018 5:56am Jun 29, 2018 5:56am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Cannot PM you as you are a new member.

Just pay whatever you believe is fair.
Your 2 posts list different requests.
Which do you want?

M.

EDIT: Don't know where code comes from but does not even compile!!
Badly written!
If you think I'm mad, I must be mad
  • Post #10
  • Quote
  • Jun 29, 2018 9:02am Jun 29, 2018 9:02am
  •  krisegale
  • | Joined Feb 2015 | Status: Member | 11 Posts
Quoting futurespec
Disliked
Cannot PM you as you are a new member. Just pay whatever you believe is fair. Your 2 posts list different requests. Which do you want? M. EDIT: Don't know where code comes from but does not even compile!! Badly written!
Ignored
Hello futurespec,
Yes. I will attach the multicurrency EA and not sell&buy242-02_Mod5A.mq4 again. The multicurrency EA already have what I wanted you to add in the sell&buy242-02_Mod5A.mq4 . So no need for sell&buy242-02_Mod5A.mq4 .

I just needed you to add :
A) 3-Simple Multipair EA v1.02
"1) The EA entry is stagnant. You have to change 0,1 or -1 manually before it can buy or sell or no trade; which suppose not to be so. I will like you to add MA (period, method and price) for the EA to buy and sell (Entry logic). That is, let the EA depend on the MA to buy or sell for each currency pair.
2) I want you to add an Lot "Exponent" and "PipStep" visible in the external tick.
All other function remains.

B) Profit_V101_demo
1) Add martingale (Exponent and PipStep)
2) Make it Multicurrency pair of 6 as captured in (A)
All other functions remains
How do I pay you? Can I pay through Bitcoin?
If my request pleases you. Send your BTC address to { email address deleted by staff }
Thanks
Attached File
File Type: mq4 Profit_V101_demo.mq4   27 KB | 159 downloads
  • Post #11
  • Quote
  • Jun 29, 2018 9:12am Jun 29, 2018 9:12am
  •  krisegale
  • | Joined Feb 2015 | Status: Member | 11 Posts
Quoting futurespec
Disliked
Cannot PM you as you are a new member. Just pay whatever you believe is fair. Your 2 posts list different requests. Which do you want? M. EDIT: Don't know where code comes from but does not even compile!! Badly written!
Ignored
Hello futurespec,
Sorry please. I did not attach it well. See attached for above job.
Thanks
Attached Files
File Type: mq4 Profit_V101_demo.mq4   27 KB | 169 downloads
File Type: mq4 3-Simple Multipair EA v1.02.mq4   9 KB | 168 downloads
  • Post #12
  • Quote
  • Jun 29, 2018 1:29pm Jun 29, 2018 1:29pm
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Hello Kris,

Sorry that is decompiled code and I will NOT work with that as it is unfair on the original coder!
When you can PM me tell me exactly what you want and let me have your email and we can start from there.

M.
If you think I'm mad, I must be mad
  • Post #13
  • Quote
  • Nov 1, 2018 2:16pm Nov 1, 2018 2:16pm
  •  crackmyback
  • | Joined Mar 2011 | Status: Member | 24 Posts
Quoting futurespec
Disliked
Hello Kris, Sorry that is decompiled code and I will NOT work with that as it is unfair on the original coder! When you can PM me tell me exactly what you want and let me have your email and we can start from there. M.
Ignored
Hi!

Please check your PM.

Thank you.
  • Post #14
  • Quote
  • Last Post: Nov 22, 2018 2:22am Nov 22, 2018 2:22am
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Check your PM.
If you think I'm mad, I must be mad
Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email This Thread Email This Thread
Search this Thread:

Advanced Search

  • Platform Tech
  • /
  • MQL4 coding to draw lines
  • Reply to Thread
0 traders viewing now
Top of Page

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

You are viewing
the Crypto Craft
beta version.

Your participation
is appreciated!

  • Facebook
  • Twitter
CC Website
  • Homepage
  • Search
  • Members
  • User Guide
  • Report a Bug
CC Products
  • Forums
  • News
  • Market
About CC
  • Mission
  • Products
  • Blog
  • Contact
Follow CC
  • Facebook
  • Twitter

Other Markets:

  • Forex Factory
  • Energy EXCH
  • Metals Mine

Crypto Craft™ is a brand of Fair Economy, Inc.

Terms of Service / ©2019