| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| How to call an .ex4 file into an EA? https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3413 |
Page 2 of 2 |
| Author: | Arav [ Fri Jan 31, 2014 5:40 pm ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
Hello, I have built a simple EA but it's not working. I mean it hasn't opened any trade yet. Please review it and match with my requirements [stated in previous post] and let me know what wrong I did. *** I think the problem lies in the EarlySignal and M3_Coral_Filter defining in the EA template. I defined them as 'bool'. But after opening the EA in the chart, I have seen that both these variables are 'False'. Can this be a problem? *I have attached the used indicators. My Code: Code: Select all |
|
| Author: | garyfritz [ Fri Jan 31, 2014 7:21 pm ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
No. That's just the default value, since you didn't specify a default initial value (like you did for the other extern inputs). You can change the inputs when you run the EA or by hitting F7 while it's running. You have more serious problems. return() says "exit this function and return this value to the function that called me." You have 4 return()s after your iCustom() calls. That means you never execute the rest of the start() function. You make the iCustom() calls, then you return Y1 and quit. You don't want those 4 return()s. Also, on line 22 you call MoneyFlowIndex on bar 2, not bar 1. Is that what you wanted? You're still sending an order on EVERY TICK when Y1 & Y2 are 1, or when Y3 & Y4 are 0. I doubt you really want that. |
|
| Author: | Arav [ Fri Jan 31, 2014 7:36 pm ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
Yes I know I can but not sure what to change. As I haven't defined them by default, so how changing them will affect the overall activities? Yes I understood what you have said. I also thought about it but to make the EA error Free, I separated them. Is there really any need to return the values at that stage or it can be done other way? You are right that the function isn't going to logical part. No there '2' means the buffer number. I identified that 'R' of 2nd indicator is buffer 2. I might be wrong. If I want to send an order on closing of every bar then would I use 1 always in the place of '0' [current bar]? Thanks |
|
| Author: | garyfritz [ Fri Jan 31, 2014 7:53 pm ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
If you don't set a value, the input will have a default value. For booleans that's False. You're passing that value into your indicator. You have to decide if that's the right value for your needs. I can't tell what those indicators do, or what parameters they take. No, there's no reason to return at that point. You haven't done anything yet except call the indicators. You're right, my mistake. No, the start() function gets called on every tick. That means anything you do it in will get executed on every tick. So (assuming you remove those 4 return() calls) when the Y1/Y2 values are 1 or Y3/Y4 are 0, you will execute those orders on every tick. You need to add logic so the orders only get placed when they should -- for example, when Y1/Y2 FIRST become 1. Arav, I give you credit for figuring out a lot of details on this, when it's clear you have no experience with Empty4. But the questions you're asking indicate a lack of understanding of basic programming concepts. You need to learn how to program before you come here and ask us to debug your EA for you. For now, you're probably going to have to find someone to program it for you. And no, that's not me. Gary |
|
| Author: | Arav [ Sat Feb 01, 2014 4:55 am ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
Gary Thanks a lot for all your Helps. You helped me a lot to get idea and discover reasons about all the buffer things and iCustom(). Actually I have some base of C & C++ because of my Study purpose. So I have some idea how to implement logic. My novish questions were mostly about the iCustom() and Buffer because I am confused about the way of utilizing them in an EA. Also I haven't found a single reference on calling an .ex4 indicator into an EA with a complete example. I had book's reference with hundreds of examples for C, C++ but here I have no other way than asking experts. I am reading and taking help from 'Andrew r Young's' EA programming book but even there he hadn't discuss much about calling .ex4 file. His examples also about just for .mq4 files. I am not asking anyone to do my coding. I am just asking why and how, then I am doing it by myself and asking for correction again. Anyway, I will Keep Trying. Thanks |
|
| Author: | SteveHopwood [ Sat Feb 01, 2014 10:48 am ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
Get started here: http://www.stevehopwoodforex.com/phpBB3 ... f=50&t=301 |
|
| Author: | Arav [ Sat Feb 01, 2014 11:17 am ] |
| Post subject: | Re: How to call an .ex4 file into an EA? |
Thanks a Lot Steve! Probably this is something I needed. I hope after finishing this, I'd be able to express my thoughts and queries more maturely. |
|
| All times are UTC | Page 2 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|