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

Flying Slope auto-trading EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=680
Page 28 of 28
Author:  zkucera [ Thu Sep 27, 2012 6:38 am ]
Post subject:  Re: Flying Slope auto-trading EA

Hi Steve,

I looked into the indicator and I think there is a small bug.

In this section of code

Code: Select all

      for (i=MaxBars; i>=0; i--)
      {
         if (signalDN[i]!=EMPTY_VALUE)
            signalDN[i]=High[i]+offset;
         if (signalUP[i]!=EMPTY_VALUE)
            signalUP[i]=Low[i]-offset;
      }
signalDN, High, signalUP and Low all reference the same bar.

Few lines down, Low references the previous bar compared to other three.

Code: Select all

      //-- short signal
      if (Draw_SellSignals && dLow>MathMax(EMAfast[i1],EMAslow[i1]))
         signalDN[i1]=High[i1]+offset;
         
      //-- long signal
      if (Draw_BuySignals && dHigh<MathMin(EMAfast[i1],EMAslow[i1]))
         signalUP[i1]=Low[i]-offset;
Not sure if that was intentional or not, but looks wrong to me. Is SwingMan on this forum (I think so, but not 100% sure)? He might be able to advise.

EDIT: Attempt to highlight sections of code in bold or red failed, I have yet to learn how to do it :-(

Cheers,
Z
Author:  meirk [ Thu Sep 27, 2012 7:17 am ]
Post subject:  Re: Flying Slope auto-trading EA

SteveHopwood wrote:
zkucera wrote:
SteveHopwood wrote:
In Crapergy testing, FS would take and close a trade, then shut up shop. The problem turns out to be in IsTradingAllowed(). The call to TooClose() in IsTradingAllowed() stopped further trading. There is something wrong in TooClose(), but blowed if I can see what. The only way to allow a resumption of trading is to comment out the call to TooClose().
Hi Steve,

I think the problem is in the following line:

Code: Select all

if (OrderCloseTime() - TimeCurrent() < (MinMinutesBetweenTrades * 60))
OrderCloseTime() - TimeCurrent() is always < 0 so the function always returns True.

Cheers,
Zeljko
Oh crap. Thanks. I had this solved at one point and have clearly unsolved it.

For those of you unable to correct this Baby Pips level bloop, the fix is in V 1k in post 1.

Thanks again Zeljco. Your contributions continue to be magnificent.

:D
Steve looked at post 1 I don't see version 1k' or I might not understand?
Author:  Romsunz [ Fri Sep 28, 2012 7:01 am ]
Post subject:  Re: Flying Slope auto-trading EA

Hi all
meirk, open mq4 file from p.1 and you will see there is a mark v1k in line 6 :)

Steve, thank you very much for this forum and good ideas you are willing to share with us.
I dont understand mq tester and I dont understand how it handles repainting indicators. I test all my ideas in Amibroker so I have to rewrite code from mq4 to afl.
Here is code to test slope indicator that does not repaint its history values:

Code: Select all

	for (i=eintPeriod+1; i<BarCount; i++)
	{
		dblSum  = float(eintPeriod+1)*Price[i];
		pdblSum  = float(eintPeriod+1)*Price[i-1];
		dblSumw = float(eintPeriod+1);
		for ( j = 1, knx = eintPeriod; j <= eintPeriod; j++, knx-- )
		{
			dblSum  +=  (float)knx * Price[i-j];
			pdblSum  +=  (float)knx * Price[i-j-1];
			dblSumw+= (float)knx;

			dblSum  += ( (float)knx * Price[i] );
			pdblSum  += ( (float)knx * Price[i] );
			dblSumw += (float)knx;
		}
		if (dblSumw!=0)
			res.array[i]=(dblSum/dblSumw)-(pdblSum/dblSumw);
		else res.array[i]=0;
	}

Also I have backtested in Amibroker the Flying Buddah idea and even without filtering it gave me very promissing results, but backtesting your ea in Empty4 gave opposite results with falling equity curve. So could you be so kind to give us your set file to backtest this ea?

Best regards,
Roman
Author:  SteveHopwood [ Fri Sep 28, 2012 7:21 am ]
Post subject:  Re: Flying Slope auto-trading EA

Romsunz wrote:Hi all
meirk, open mq4 file from p.1 and you will see there is a mark v1k in line 6 :)

Steve, thank you very much for this forum and good ideas you are willing to share with us.
I dont understand mq tester and I dont understand how it handles repainting indicators. I test all my ideas in Amibroker so I have to rewrite code from mq4 to afl.
Here is code to test slope indicator that does not repaint its history values:

Code: Select all

	for (i=eintPeriod+1; i<BarCount; i++)
	{
		dblSum  = float(eintPeriod+1)*Price[i];
		pdblSum  = float(eintPeriod+1)*Price[i-1];
		dblSumw = float(eintPeriod+1);
		for ( j = 1, knx = eintPeriod; j <= eintPeriod; j++, knx-- )
		{
			dblSum  +=  (float)knx * Price[i-j];
			pdblSum  +=  (float)knx * Price[i-j-1];
			dblSumw+= (float)knx;

			dblSum  += ( (float)knx * Price[i] );
			pdblSum  += ( (float)knx * Price[i] );
			dblSumw += (float)knx;
		}
		if (dblSumw!=0)
			res.array[i]=(dblSum/dblSumw)-(pdblSum/dblSumw);
		else res.array[i]=0;
	}

Also I have backtested in Amibroker the Flying Buddah idea and even without filtering it gave me very promissing results, but backtesting your ea in Empty4 gave opposite results with falling equity curve. So could you be so kind to give us your set file to backtest this ea?

Best regards,
Roman
My set file are the release defaults.

:D
Author:  Carioca [ Sun Sep 30, 2012 1:26 pm ]
Post subject:  Re: Flying Slope auto-trading EA

thanks Steve

It seems that the TF D1 and the best.

I did a quick backtesting and it seems that something is wrong in the TP and SL and placed 200 pips plus the stoploss is not exactly the 200 pips
Author:  Carioca [ Sat Oct 06, 2012 4:13 am ]
Post subject:  Re: Flying Slope auto-trading EA

Carioca wrote:thanks Steve

It seems that the TF D1 and the best.

I did a quick backtesting and it seems that something is wrong in the TP and SL and placed 200 pips plus the stoploss is not exactly the 200 pips
I managed to leave as I wanted more and ended up using SL TP based on ATR.

Anyone here know where I should edit the code so that it opens a trade every signal.

I was thinking let's say you have 5 arrows then opens a sales venda on each arrow until an arrow appears purchase and close all trades.

And an option to choose a minimum of pips between a sale and another does not make much sense for him to open another venda 5 pips above.
Author:  cuzgeorge [ Sun Oct 07, 2012 12:25 pm ]
Post subject:  Re: Flying Slope auto-trading EA

Hi all,
started to get some trades late in the week after setting the TF at 240 at using the lower 60M TF for the indi.

Not much to post on, but will elaborate when have more results. So far,3 losers, one winner, and one open, winning position. :D
regards
cuz
Author:  SteveHopwood [ Sun Oct 07, 2012 12:44 pm ]
Post subject:  Re: Flying Slope auto-trading EA

cuzgeorge wrote:Hi all,
started to get some trades late in the week after setting the TF at 240 at using the lower 60M TF for the indi.
Yes, anyone waiting for the D1 to go into trading territory is waiting tradeless for the time being.

Hey ho.

:D
Author:  cuzgeorge [ Wed Oct 24, 2012 10:03 am ]
Post subject:  Re: Flying Slope auto-trading EA

Hi Steve, all,
look slike we're getting trades now from FS. I'm attaching my set file and although i'm not thrilled with the results yet, i see a start here that we at least have trades.
i'm running this set file on 6 main pairs, with lower spreads, all on 1HR charts.
I have had trades with this set file, but cant quite get the exit right. Play around with the set, at the mo i have BE turned off, but playing around with the slope values and seeing what else comes up.

I also have MPTM on the same platform and worth noting is that i cant see any trades that MPTM picked up from FS yet. I.E the positions either close before they go into significant losses for MPTM to pick up, or they move on to close by JS or a slope value change.
Good thing to note, i have no errors for a few months and it appears its own MM code is working fine.

I've also used different EA's on the same platform with diff Magics and have had no probs so far. Multi and WB are on the same platform, no obvious clashes, but shout out if you have experienced issues please. I did this for very slow trading EA's as i needed the demo platforms. Results are in the demo list linked under my signature. Look for the 1:200 Markets platform with the EA's names if you' would like to peruse the results and open trades.
regards and have a blast guys.
cuz
All times are UTC Page 28 of 28