stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Indicator Request
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4019
Page 3 of 7
Author:  Reaper [ Tue Jan 06, 2015 6:00 am ]
Post subject:  Indicator Request

Firstly, thank you both of you for helping me with my indicator coding. I have since created 3 more indicators and pretty much know what I'm doing there. So big thank you again. :good:

If I can call upon your help once more, I need to build an EA. I've had a look a different EAs and how they're put together, I've also checked out the MQL4 site, I could probably make an EA, but making it do what I need it to do is the tricky part. :lol:

Could someone create me a basic EA that either has Angat_VLines hardcoded into it or does an iCustomCall or some other way that pulls the VLINES objects out and uses it with a trade condition:

Quite simply if there's 1 LONG bar after a Vertical Line taken from Angats_VLines, the EA is to open a trade.

If anybody can create me a very basic skeleton EA that works like this, I can backward engineer it and learn and modify it to my needs.

Thank you :hi:
Author:  Reaper [ Tue Jan 06, 2015 5:07 pm ]
Post subject:  Indicator Request

So I've been struggling on this all day, I've given up on trying to turn my indicator into an EA. I got stuck on not being allowed both oncalculate() and start(). And then also my Empty4 wouldn't recognised it as an EA. I'm going to go back to try and use the regular icustom way. But I take it this does nothing without the my indicator having a buffer array set right?

So within in the EA I have:

double VLines=iCustom(NULL,0,"Angat_VLines_1.08 (slim)",false,15,6000,1,0);

with has 3 inputs .. false, 15, 6000.

So this is where I'm stuck at the moment, what I need stored from the indicator is a simple true or false, whether bar[2] has a vertical line on it or not. I'm using ObjectFind to find an alphaline_2 object and if it exists that means the Vertical line is there.

Can anyone help me with the buffer code pls?

Code: Select all

bool  SetIndexBuffer(int 0, bool ExtBuffer, bool);


int OnInit()
{


if(ObjectFind(0,"AlphaLine_2")==0)
 
 {
  bool  ExtBuffer == true;
 }
 else {
return (false);
 }

}
 
Author:  milanese [ Tue Jan 06, 2015 5:48 pm ]
Post subject:  Indicator Request

Angat » Tue Jan 06, 2015 5:07 pm wrote:So I've been struggling on this all day, I've given up on trying to turn my indicator into an EA. I got stuck on not being allowed both oncalculate() and start(). And then also my Empty4 wouldn't recognised it as an EA. I'm going to go back to try and use the regular icustom way. But I take it this does nothing without the my indicator having a buffer array set right?

So within in the EA I have:

double VLines=iCustom(NULL,0,"Angat_VLines_1.08 (slim)",false,15,6000,1,0);

with has 3 inputs .. false, 15, 6000.

So this is where I'm stuck at the moment, what I need stored from the indicator is a simple true or false, whether bar[2] has a vertical line on it or not. I'm using ObjectFind to find an alphaline_2 object and if it exists that means the Vertical line is there.

Can anyone help me with the buffer code pls?

Code: Select all

bool  SetIndexBuffer(int 0, bool ExtBuffer, bool);


int OnInit()
{


if(ObjectFind(0,"AlphaLine_2")==0)
 
 {
  bool  ExtBuffer == true;
 }
 else {
return (false);
 }

}
 
You can use Steve's shell ---> http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79 as a starting point, here you can add the indicator code directly in ReadIndicators() with some adaptions, this would be easier and better for the kind of indicator you have as doing it with iCustom calls and modifying the indicator imo..

Cheers :)

Tommaso
Author:  Reaper [ Tue Jan 06, 2015 6:20 pm ]
Post subject:  Indicator Request

thank you, I just now went back to tried again to figure out why my indicator to ea conversion didn't work and I just figured that out!! so yeah I will be plodding on with the indicator/ea combined version. Thank you for your shell link. I will try it out too.

Cheers, finally getting somewhere. :)
Author:  Reaper [ Tue Jan 06, 2015 8:32 pm ]
Post subject:  Indicator Request

Had a look through steve's shell and its a mammoth. What I rather do it get my ea functioning first, and sort my conditions properly and then perhaps down the road migrate to that shell.

A couple of current issues I have right now is error 130 when using OrderSend and how to ensure it doesnt open more than one trade from the same signal. :?
Author:  SteveHopwood [ Tue Jan 06, 2015 10:21 pm ]
Post subject:  Indicator Request

Angat » Tue Jan 06, 2015 8:32 pm wrote:Had a look through steve's shell and its a mammoth. What I rather do it get my ea functioning first, and sort my conditions properly and then perhaps down the road migrate to that shell.

A couple of current issues I have right now is error 130 when using OrderSend and how to ensure it doesnt open more than one trade from the same signal. :?
It is all in my shells.

Having said that, you are actually better off learning this stuff for yourself. Just remember that every time you reinvent a wheel that someone else has already invented, that is exactly what you are doing. I wise newbie coder will also consult my shells for techniques that you can adapt for yourself. A lot of them have been provided by the Proper Coders here, and only an idiot turns down that level of expertise. For sure, I never have.

:xm:
Author:  Reaper [ Tue Jan 06, 2015 11:58 pm ]
Post subject:  Indicator Request

SteveHopwood » Tue Jan 06, 2015 10:21 pm wrote:
Angat » Tue Jan 06, 2015 8:32 pm wrote:Had a look through steve's shell and its a mammoth. What I rather do it get my ea functioning first, and sort my conditions properly and then perhaps down the road migrate to that shell.

A couple of current issues I have right now is error 130 when using OrderSend and how to ensure it doesnt open more than one trade from the same signal. :?
It is all in my shells.

Having said that, you are actually better off learning this stuff for yourself. Just remember that every time you reinvent a wheel that someone else has already invented, that is exactly what you are doing. I wise newbie coder will also consult my shells for techniques that you can adapt for yourself. A lot of them have been provided by the Proper Coders here, and only an idiot turns down that level of expertise. For sure, I never have.

:xm:
No doubt Steve, I had a good look in that shell. It has everything that I could ever want. I'm not turning it down however, I'm just taking baby steps. I've managed to achieved a hell of a lot within 24 hours. I've built 4 indicators and nearly got a working EA! I'm not sure about how others code here, but I like to have a clear head and take things one step at a time. What I'd like to do eventually is take apart your shell and really learn how each module works, but no time for that at moment.

Cheers
Author:  Reaper [ Thu Jan 08, 2015 1:24 pm ]
Post subject:  Indicator Request

Trying to make some predefine candle variables but Empty4 doesn't like my coding, lol.

Code: Select all

bool TallAlphaLongBar = Close[2] > Open[2] && Close[2] – Open[2] > 10*Point && High[2] – Low[2] >= 20*Point;
Can someone tell me what I have done wrong here?

Also, should I be using iHigh, iClose, iOpen, iLow over High[], Close[], Open[], Low[] and if so why?

Thanks in advance. :hi:

EDIT: I'm only using one chart, so shouldn't High[], Close[],... arrays suffice?

Thanks
Author:  milanese [ Thu Jan 08, 2015 2:56 pm ]
Post subject:  Indicator Request

Angat » Thu Jan 08, 2015 1:24 pm wrote:Trying to make some predefine candle variables but Empty4 doesn't like my coding, lol.

Code: Select all

bool TallAlphaLongBar = Close[2] > Open[2] && Close[2] – Open[2] > 10*Point && High[2] – Low[2] >= 20*Point;
Can someone tell me what I have done wrong here?

Also, should I be using iHigh, iClose, iOpen, iLow over High[], Close[], Open[], Low[] and if so why?

Thanks in advance.

EDIT: I'm only using one chart, so shouldn't High[], Close[],... arrays suffice?

Thanks
bool(boolean) gives you true or false as return, so you can not use this variable type, than what you have on the right sight is a classical ifcondition you should try to read in the MQL4 language manual more about this all..---> http://docs.mql4.com/
it would probably look like something:

Code: Select all

bool allAlphaLongBar=false;//initialize the variable allAlphaLongBar

if ((Close[2] > Open[2]) && ((Close[2] – Open[2] )> 10*Point) && ((High[2] – Low[2]) >= 20*Point)))
allAlphaLongBar=true;
Cheers :)

Tommaso
Author:  Reaper [ Thu Jan 08, 2015 3:44 pm ]
Post subject:  Indicator Request

milanese » Thu Jan 08, 2015 2:56 pm wrote:
Angat » Thu Jan 08, 2015 1:24 pm wrote:Trying to make some predefine candle variables but Empty4 doesn't like my coding, lol.

Code: Select all

bool TallAlphaLongBar = Close[2] > Open[2] && Close[2] – Open[2] > 10*Point && High[2] – Low[2] >= 20*Point;
Can someone tell me what I have done wrong here?

Also, should I be using iHigh, iClose, iOpen, iLow over High[], Close[], Open[], Low[] and if so why?

Thanks in advance.

EDIT: I'm only using one chart, so shouldn't High[], Close[],... arrays suffice?

Thanks
bool(boolean) gives you true or false as return, so you can not use this variable type, than what you have on the right sight is a classical ifcondition you should try to read in the MQL4 language manual more about this all..---> http://docs.mql4.com/
it would probably look like something:

Code: Select all

bool allAlphaLongBar=false;//initialize the variable allAlphaLongBar

if ((Close[2] > Open[2]) && ((Close[2] – Open[2] )> 10*Point) && ((High[2] – Low[2]) >= 20*Point)))
allAlphaLongBar=true;
Cheers :)

Tommaso
Thank you for your reply. It is Boolean, but for some unknown reason it wasn't recognising my "-" sign. It was coming out pink in the MQL4 editor. Sorted it now. Cheers.
All times are UTC Page 3 of 7