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

Fmfx auto-trader. Another new toy by Steve Hopwood
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=318
Page 12 of 13
Author:  Fmfx [ Fri Mar 30, 2012 10:28 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

SteveHopwood wrote:
Fmfx wrote:Thanks Steve :)

Attached is the moded version.

:)
What problem are you having?

:D
Thanks Boss,

The problem is that the ea still takes trades even when the rsi is in between 55 and 45 level (Ranging).

Thanks
Regards
Author:  SteveHopwood [ Fri Mar 30, 2012 10:47 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

I am confused.

Your source code:
extern string trsi="Rsi trend detection";
extern bool UseRsiTrendDetection=false;
extern int RsiTdTf=1440;
extern int RsiTdPeriod=20;
extern string trs="Applied price: 0=Close; 1=Open; 2=High";
extern string trs1="3=Low; 4=Median; 5=Typical; 6=Weighted";
extern int RsiTdAppliedPrice=0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double TrendRsiVal;//Rsi
string RsiTrend;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Your set file:
UseRsiTrendDetection=1
RsiTdTf=240
RsiTdTf,F=0
RsiTdTf,1=1440
RsiTdTf,2=0
RsiTdTf,3=0
RsiTdPeriod=14
RsiTdPeriod,F=0
RsiTdPeriod,1=20
RsiTdPeriod,2=0
RsiTdPeriod,3=0
trs=Applied price: 0=Close; 1=Open; 2=High
trs1=3=Low; 4=Median; 5=Typical; 6=Weighted
RsiTdAppliedPrice=0
RsiTdAppliedPrice,F=0
RsiTdAppliedPrice,1=0
RsiTdAppliedPrice,2=0
RsiTdAppliedPrice,3=0

The two do not match up. You appear to have more inputs in your set file than you have in your source code.

:D
Author:  Fmfx [ Fri Mar 30, 2012 10:59 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

SteveHopwood wrote:I am confused.

Your source code:
extern string trsi="Rsi trend detection";
extern bool UseRsiTrendDetection=false;
extern int RsiTdTf=1440;
extern int RsiTdPeriod=20;
extern string trs="Applied price: 0=Close; 1=Open; 2=High";
extern string trs1="3=Low; 4=Median; 5=Typical; 6=Weighted";
extern int RsiTdAppliedPrice=0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double TrendRsiVal;//Rsi
string RsiTrend;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Your set file:
UseRsiTrendDetection=1
RsiTdTf=240
RsiTdTf,F=0
RsiTdTf,1=1440
RsiTdTf,2=0
RsiTdTf,3=0
RsiTdPeriod=14
RsiTdPeriod,F=0
RsiTdPeriod,1=20
RsiTdPeriod,2=0
RsiTdPeriod,3=0
trs=Applied price: 0=Close; 1=Open; 2=High
trs1=3=Low; 4=Median; 5=Typical; 6=Weighted
RsiTdAppliedPrice=0
RsiTdAppliedPrice,F=0
RsiTdAppliedPrice,1=0
RsiTdAppliedPrice,2=0
RsiTdAppliedPrice,3=0

The two do not match up. You appear to have more inputs in your set file than you have in your source code.

:D

Hi Boss,

This is kind of confusing :), i'm cracking my brain here but couldn't figure out where that came from :roll:

Men i have along way to go :roll:
Author:  SteveHopwood [ Fri Mar 30, 2012 11:04 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

You have posted a set file with more inputs than your source code. Either you have posted the wrong source, or the wrong set. From you set, it looks as though you are using a mtf Rsi, but this does not show up in your source.

:D
Author:  Fmfx [ Fri Mar 30, 2012 11:16 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

Yes boss, i think the set file is wrong, probably i mixed it.

And attached is the mtf sri indicator i was trying to incorporate.

Thanks
Author:  SteveHopwood [ Fri Mar 30, 2012 11:47 pm ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

Fmfx wrote:Yes boss, i think the set file is wrong, probably i mixed it.

And attached is the mtf sri indicator i was trying to incorporate.

Thanks
Forget the mtf Rsi - that is for chart display only. For an ea, you use calls to the resident RSI that ships with Empty4.

Save the attached using a different name, so you do not lose your original source. What I have done is added code that make the mtf calls to the D1 and H1 time frames, to give you examples you can adapt for your own use:
  • 1) to the inputs list. Note how the inputs have the same names apart from the prefixes D1 and H1 - makes it a lot easier to work with variables.
    2) to void TrendDetectionModule(), that sets up the two trend variables
    3) to void LookForTradingOpportunities(), showing how to use the defined trends to allow/cancel the potential trade.
From this, you can see how it is possible to add infinite Rsi trend spotting thingies by copy/paste/edit. Have fun.

:D

Note: Remember that my additions are untested code and that I am a crap copy/paste/editor, so there may be bugs. What I am trying to pass on here is a general idea.
Author:  Fmfx [ Fri Mar 30, 2012 11:58 pm ]
Post subject:  Noted boss

Thanks Boss, noted.

I will have it on my vps on monday as soon as market opens, thanks for your kind help, God bless :D.

Regards
Author:  SteveHopwood [ Sat Mar 31, 2012 12:07 am ]
Post subject:  Re: Noted boss

Fmfx wrote:Thanks Boss, noted.

I will have it on my vps on monday as soon as market opens, thanks for your kind help, God bless :D.

Regards
Don't you dare do anything of the sort. Do so and it will destroy your hard drive and burn down your home.

The point of what I posted was to give you a general nudge in the right direction, not a tradable EA. You must adapt it first to avoid the above consequences.

:D
Author:  Fmfx [ Sat Mar 31, 2012 12:14 am ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

Ho :o , like i said earlier i have a long way to go. I will give it a go at day break, its 01:00am here already.

Thanks once again boss :D.

Regards
Author:  SteveHopwood [ Sat Mar 31, 2012 12:18 am ]
Post subject:  Re: Fmfx auto-trader. Another new toy by Steve Hopwood

I see that someone other than Fmfx is interested in what is going on here, so a few more words of explanation.

Those of us who are not trained programmers have to adopt our own coding style. In doing so, consistency helps a lot. Look at the code snippet that offers up external inputs to the user when the EA uses a moving average:

Code: Select all

extern string  mai="----Moving average----";
extern int     MaTF=0;//Time frame defaults to current chart 
extern int     MaPeriod=50;
extern int     MaShift=0;//The MA Shift input
extern string  mame="Method: 0=sma; 1=ema; 2=smma;  3=lwma";
extern int     MaMethod=1;
extern string  maap="Applied price: 0=Close; 1=Open; 2=High";
extern string  maap1="3=Low; 4=Median; 5=Typical; 6=Weighted";
extern int     MaAppliedPrice=0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double         MaVal;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Now remove the 'Ma' from each input:

Code: Select all

extern int     TF=0;//Time frame defaults to current chart 
extern int     Period=50;
extern int     Shift=0;//The MA Shift input
extern string ame="Method: 0=sma; 1=ema; 2=smma;  3=lwma";
extern int     Method=1;
extern string  ap="Applied price: 0=Close; 1=Open; 2=High";
extern string  ap1="3=Low; 4=Median; 5=Typical; 6=Weighted";
extern int     AppliedPrice=0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double         Val;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
What we are left with is a generic set of inputs that relate to the fields of indi's that we use all the time on our charts.

So, all I do when setting up a group of external inputs is place a shortened form of the indi in front of the variables to customise them - RsiTF, AtrTF, BandsTF etc

As my amateur coding evolves, so does my ability to structure my code in such a way that LUC has fewer and fewer opportunities to invite his buddies for lunch. Variable naming consistency helps me a lot.

:D
All times are UTC Page 12 of 13