Multi 10:4 Trader EA

Post Reply
User avatar
McNish
Trader
Posts: 227
Joined: Tue Nov 06, 2012 3:56 pm

Re: Multi 10:4 Trader EA

Post by McNish »

SteveHopwood wrote: :D
Just goes to show even the Smartest Brains can be taken for a ride sometimes. 8-)

@ Andy : While allisonmagic (aka GH) suggested to keep moving the pendings as price keeps moving further away in the opp direction, one need to keep couple of things in mind. 1) The RSI / Sto are still valid (above / below cut off) in the current bar. 2) The last H4 candle's high / low (as the case may be) is clear of the last pivot / SR's / mid SR's where the pendings are going to be placed (presuming that we are working / calculating from this TF). See pic for clarity.
usdcadh4.png
3) This is more of a request. In the YAD V4, there was filter check to see if the H / L of the day was clear of the 240 ma. Can we have this in the current DB / EA please?

Will post more as EA progresses.

In a weeks time or two, I believe we'll have a fully functional EA here. Courtesy of 'The Shrugged Atlas'.

Regards,
You do not have the required permissions to view the files attached to this post.
MrLong

Re: Multi 10:4 Trader EA

Post by MrLong »

slipshod wrote:Here's the changes I made on my end, hope they're useful! If there's anything incorrect or that could have been done better please let me know :)

firstly there's changes to function calls in start()...

Code: Select all

stop = CalculateStopLoss(CurrentPair, OP_BUY, price);
take = CalculateTakeProfit(CurrentPair, OP_BUY, price);
Do the same for sells as well, with OP_SELL of course. Now for the functions themselves:-

Code: Select all

double CalculateStopLoss(string symbol, int type, double entry) {
        // askPrice and bidPrice no longer needed as we're using the real entry value
	// double askPrice = MarketInfo(symbol, MODE_ASK);
	// double bidPrice = MarketInfo(symbol, MODE_BID);
	double stop, price = entry;

	RefreshRates();

	if (type == OP_BUY) {
		//price = askPrice;
		if (!CloseEnough(stopLoss, 0)) {
			stop = price - (stopLoss / factor);
		}

		
		if (UseMovingAverage)
			stop = MaVal;
	} 

	if (type == OP_SELL) {
		//price = bidPrice;
		if (!CloseEnough(stopLoss, 0)) {
			stop = price + (stopLoss / factor);
		}

		
		if (UseMovingAverage)
			stop = MaVal;
	} 

	return(stop);
} 

double CalculateTakeProfit(string symbol, int type, double entry) {
	// again, no need for askPrice and bidPrice anymore
	//double askPrice = MarketInfo(symbol, MODE_ASK);
	//double bidPrice = MarketInfo(symbol, MODE_BID);
	double take, price = entry;

	RefreshRates();

	if (type == OP_BUY) {
                // make sure that take is incorrect to start with, that way we can be sure when
                // we get a valid take value...
		take = entry - 20 * Point;

		if (!CloseEnough(takeProfit, 0)) {
			take = price + (takeProfit / factor);
		}
		
                // note that below I set take to higher resistance levels even if the Use flag for them
                // hasn't been set, but only if the desired resistance level is below our entry...
		if (UseMidSR1)
			take = MR1;
		if (UseSR1 || take < entry)
			take = R1;
		if (UseMidSR2 || take < entry)
			take = MR2;
		if (UseSR2 || take < entry)
			take = R2;
		if (take < entry)
                {
                        // still can't get a valid take value using the pivots, so I've defaulted
                        // to 2 * ATR as a placeholder to ensure we have something to use.
                        take = entry + iATR(symbol, PERIOD_H4, 20, 0)*2;
                }
	} 

	if (type == OP_SELL) {
		take = entry + 20 * Point;

		if (!CloseEnough(takeProfit, 0)) {
			take = price - (takeProfit / factor);
		}
		
		if (UseMidSR1)
			take = MS1;
		if (UseSR1 || take > entry)
			take = S1;
		if (UseMidSR2 || take > entry)
			take = MS2;
		if (UseSR2 || take > entry)
			take = S2;
		if (take > entry)
		   take = entry - iATR(symbol, PERIOD_H4, 20, 0)*2;
	}

	return(take);
}
Btw another change I've made is to split the lotsize in half and enter twice, once with a TP and once without (I'll trail the market with the second order). I don't know if this is valid under 10.4 rules or would improve or harm its profitability, but its something I wanted to try. Its a simple change, can post it if anyone wants ... if it does prove useful perhaps its something Andy could add an option for in a future version?
Hi Slipshod,

Thanks for you code, looks good.

Job for the boyz this debuugging, I can see why Steve climbs in that hot bath :lol: :lol:

Andy
User avatar
McNish
Trader
Posts: 227
Joined: Tue Nov 06, 2012 3:56 pm

Re: Multi 10:4 Trader EA

Post by McNish »

Know What ! There's hardly anyone at the DBM threads that I'm so keenly working on. You've stolen the show here at SHF Andy. :x :cry:

I vow to get even. :evil:

With Warm Regards, MAX.
MrLong

Re: Multi 10:4 Trader EA

Post by MrLong »

websie wrote:I know absolutely nothing about coding but when looking at this EA this bit here about the time of deleting the pendings you have set for 16.00 which is 4pm, was it really meant to be 6pm, in which case it's 18.
Is that correct to change the 16 to 18?
extern int PendingTradeDeletionHour = 16; //6.00 pm
if you would like to delete the orders at 18 thats ok.
MrLong

Re: Multi 10:4 Trader EA

Post by MrLong »

McNish wrote:
SteveHopwood wrote: :D
Just goes to show even the Smartest Brains can be taken for a ride sometimes. 8-)

@ Andy : While allisonmagic (aka GH) suggested to keep moving the pendings as price keeps moving further away in the opp direction, one need to keep couple of things in mind. 1) The RSI / Sto are still valid (above / below cut off) in the current bar. 2) The last H4 candle's high / low (as the case may be) is clear of the last pivot / SR's / mid SR's where the pendings are going to be placed (presuming that we are working / calculating from this TF). See pic for clarity.
usdcadh4.png
3) This is more of a request. In the YAD V4, there was filter check to see if the H / L of the day was clear of the 240 ma. Can we have this in the current DB / EA please?

Will post more as EA progresses.

In a weeks time or two, I believe we'll have a fully functional EA here. Courtesy of 'The Shrugged Atlas'.

Regards,
OK, thanks.
och
Posts: 7
Joined: Fri Sep 14, 2012 8:19 am

Re: Multi 10:4 Trader EA

Post by och »

slipshod wrote:I added a few debugging lines to see what trades its trying to take, and am seeing it trying to open a sell on EURAUD at the price -0.0004, which is predictably failing.

It also tried a Buy Stop on AUDCAD at 1.0604 with a TP at 1.0599 (less than the entry price), and similar TP errors on EURUSD and GBPAUD.

(I've got Stealth turned off, as I can't run a computer 24 hours a day).
Same issue with AUDNZD. I made a little debugging and this is coming from GetNextSupport and/or GetNextResistance as it never fit the conditions and so Pivot remain to 0. Then Price is calculated using Pivot - (Buffer/factor), so negative... In that case Last resistance is below Price ,so bid can never be between two last resistances...

I am quite new to that system, so as I do not fully undersand rules, I have no clue what to change...
You do not have the required permissions to view the files attached to this post.
User avatar
Baluda
Trader
Posts: 330
Joined: Mon Feb 06, 2012 2:00 pm
Location: An insignificant village in the Netherlands

Re: Multi 10:4 Trader EA

Post by Baluda »

Here is something strange. I do not know if this has been reported yet.

Journal tab:
AUDNZD Journal.png
Experts tab:
AUDNZD Experts.png
A pending AUDNZD order was opened, triggered and closed because of a 'reversal'. All within 20 seconds.

FWIW times are local, GMT+2. Subtract one hour for Cowboy IBFX server times.

Paul
You do not have the required permissions to view the files attached to this post.
Check the MQL4 Market for my best EA's and Indicators.
User avatar
Pippa
Trader
Posts: 53
Joined: Sun Feb 03, 2013 2:12 am

Re: Multi 10:4 Trader EA

Post by Pippa »

Hello Everyone,

Following this thread with great interest.

Due to my lack of any Coding skills am avidly watching, learning and very impressed!

Thank you Mr. Long!

Regards,

Pippa
User avatar
aworex
Trader
Posts: 68
Joined: Thu Sep 20, 2012 2:42 pm
Location: London UK

Re: Multi 10:4 Trader EA

Post by aworex »

:o
Baluda wrote:Here is something strange. I do not know if this has been reported yet.

Journal tab:
AUDNZD Journal.png
Experts tab:
AUDNZD Experts.png
A pending AUDNZD order was opened, triggered and closed because of a 'reversal'. All within 20 seconds.

FWIW times are local, GMT+2. Subtract one hour for Cowboy IBFX server times.

Paul

I experienced the same error with the AUDNZD with it opening and closing the trade several times, with my FXCM broker here in the UK :cry:
Kruspe
Trader
Posts: 121
Joined: Sat May 19, 2012 3:34 pm
Location: Prague, Czech Republic

Re: Multi 10:4 Trader EA

Post by Kruspe »

Same experience here with audnzd (Cowboy IBFX)
Once you "see", you can not unsee. CJ
Post Reply

Return to “Nanningbob 10.x”