Gogetter EA - page 3

 

have you forward test this EA ?

 

Hey,

In my hurry to give you something to work on, I missed something obvious. Please modify your line of the code which looks like this

if(OrderSymbol()==Symbol()||OrderMagicNumber()==MagicNumber)

to

if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)

Sorry, it was an oversight. It would have messed up when you started trading multiple currencies with the same EA and same Magicnumber.

Anyway, I am glad that you are doing well. Good job and you deserve all the credit.

 
Maji:
Hey,

In my hurry to give you something to work on, I missed something obvious. Please modify your line of the code which looks like this

if(OrderSymbol()==Symbol()||OrderMagicNumber()==MagicNumber)

to

if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)

Sorry, it was an oversight. It would have messed up when you started trading multiple currencies with the same EA and same Magicnumber.

Anyway, I am glad that you are doing well. Good job and you deserve all the credit.

that did have me curious but I went with it...all is well that ends well...corrections completed. now I get to see if I can upgrade GGs

 

GGlongs Build 1.05

There that's better.

Thanks to Maji once again for guiding me thru enhancing the counting methods of multiple orders and the problems of multiple order handling/modifying etc.

This uses a new trailing stop function as well as new counting function thruout.

I also worked over Signal_2 which is what did the graph thumbnail attached below. That is the main Trend signal. I have not yet worked over the countertrend signal_1 yet. But signal_2 is acceptable with these settings for redeployment on the GBP/USD 5m chart.

In forward testing the previous version of GGlongs failed to enter a clear buy signal this morning. I found in looking over the signal logic in v1.01 that I really had it all mixed up worse than I thought I did. anyway problem resolved...v1.05 should forward test much better now than v1.01 did. I will put v1.05 on the forward tester now beside v2.11 GGs which hasn't received any of these new features yet.

 

I notice on the unaltered chart where it's not modifying at all...it's not entering a new series on the heels of the last series like it always has done before...I wonder why??? How could the changes I've made do that?

I discovered that this was because I messed up the signal logic...mystery solved.

Files:
 

i'm confused....

This is what IS working just peachy in the GGl.....

int ModifyTrades()

{

int trade;

for(trade=OrdersTotal()-1;trade>=0;trade--)

{

OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=MagicNumber)

continue;

if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)

if(TrailingStopMode && TrailingStop > 0) {

if(Bid - OrderOpenPrice() > Point * TrailingStop || OrderOpenPrice() - Bid >= 0) {

if(OrderStopLoss() < Bid - Point * TrailingStop || OrderStopLoss() == 0) {

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen); //etc.

}//for

}

}

}

} [/PHP]

so....

why doesn't this work in the GGs???

[PHP]int ModifyTrades()

{

int trade;

for(trade=OrdersTotal()-1;trade>=0;trade--)

{

OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=MagicNumber)

continue;

if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)

if(TrailingStopMode && TrailingStop > 0) {

if((OrderOpenPrice() - Ask) > (Point * TrailingStop || Ask - OrderOpenPrice() >= 0)) {

if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen); //etc.

}//for

}

}

}

}

as you can see in the report attached there isn't any 'modifying' happening... ...come to think of it...I've never seen ANY trailing stop modification activity on ANY of the GGs version reports!! What's up with that???

Files:
ggs2.21.htm  149 kb
ggs2.21.gif  7 kb
 

My next coding challenge...

I want to add support and resistance to the logics of my EA....

This works fine to return a value for the highest high of a specified number of bars...

//support and resistance

double HIGH = High;

double LOW = Low[Lowest (NULL, 0, MODE_LOW, SupportBarsBack, LStartBack)];

In focusing on the GGs. I notice that in every 145 bars on the 30m chart. there is a highest high followed by three countertrend sell signals. I define a countertrend sell signal as every time the 5ema crosses from above to below the 18ema which occurs above the 150ema. So the pattern I see is that there is a new high followed by sell signals.

I further observe that the first sell signal after a new high is not very productive. The second one is generally more rewarding and the third one etc. is where the bigger moves occur.

So...

Since I can now generate tailored signals to each situation I want to customize signals to execute at these different occurances all in relation to the new high or the highest high of the current 145bar period.

The signals I can handle customizing...

The challenge is going to be locating the countertrend sell signal in relation to the highest high of the current 145bar period, and counting how many times this signal has already happened since the highest high of that period.

I'm not sure how to count the signal occurances. I mean I can count on the chart but how do I make the code do the counting?

 

how do I determine how many bars back in the array from the time I get the moving average cross signal that the highest high occurred?

 

ok I see how to get the arraymaximum and array minimum...this gives me the bar number that the value occurs on but it gives it to me in terms of a bar number in the chart...

if I could get the bar number of the bar where the moving average cross happens I could subtract the two to see how many bars back the support or resistance is from the occurance of the signal...

how do I get the chart bar number when the moving average cross signal occurs?

 
/support and resistance

double HIGH = High;

double LOW = Low[Lowest (NULL, 0, MODE_LOW, SupportBarsBack, LStartBack)];

//support and resistance location

int Hloc = ArrayMaximum(High);

int Lloc = ArrayMinimum(Low);

.

.

.

Print("Order Number: ",OrderTicket() ," ",ResistanceBarsBack," bars back resistance : ",HIGH," @bar",Hloc," & ",SupportBarsBack," bars back support : ",LOW," @bar",Lloc);

[/PHP]

this is what this code is giving me...

[PHP]2006.07.19 15:27:54 2005.03.10 21:30 GoGetShorts-2.21x GBPUSD,M30: Order Number: 6 20 bars back resistance : 1.9284 @bar109 & 20 bars back support : 1.9204 @bar205

2006.07.19 15:27:54 2005.03.10 21:30 GoGetShorts-2.21x GBPUSD,M30: SELL order opened : 1.9223

2006.07.19 15:27:54 2005.03.10 21:30 GoGetShorts-2.21x GBPUSD,M30: open #6 sell 0.05 GBPUSD at 1.9223 sl: 1.9270 tp: 1.9118 ok

2006.07.19 15:27:54 2005.03.10 21:30 GoGetShorts-2.21x GBPUSD,M30: open #5 sell 0.05 GBPUSD at 1.9223 sl: 1.9270 tp: 1.9118 ok

2006.07.19 15:27:54 2005.03.07 15:30 GoGetShorts-2.21x GBPUSD,M30: Order Number: 4 20 bars back resistance : 1.9224 @bar44 & 20 bars back support : 1.9114 @bar49

2006.07.19 15:27:54 2005.03.07 15:30 GoGetShorts-2.21x GBPUSD,M30: SELL order opened : 1.9146

2006.07.19 15:27:54 2005.03.07 15:30 GoGetShorts-2.21x GBPUSD,M30: open #4 sell 0.05 GBPUSD at 1.9146 sl: 1.9193 tp: 1.9041 ok

2006.07.19 15:27:54 2005.03.07 15:30 GoGetShorts-2.21x GBPUSD,M30: open #3 sell 0.05 GBPUSD at 1.9146 sl: 1.9193 tp: 1.9041 ok

2006.07.19 15:27:54 2005.03.02 16:30 GoGetShorts-2.21x GBPUSD,M30: Order Number: 2 20 bars back resistance : 1.9186 @bar100 & 20 bars back support : 1.908 @bar15

2006.07.19 15:27:54 2005.03.02 16:30 GoGetShorts-2.21x GBPUSD,M30: SELL order opened : 1.9121

2006.07.19 15:27:54 2005.03.02 16:30 GoGetShorts-2.21x GBPUSD,M30: open #2 sell 0.05 GBPUSD at 1.9121 sl: 1.9168 tp: 1.9016 ok

2006.07.19 15:27:54 2005.03.02 16:30 GoGetShorts-2.21x GBPUSD,M30: open #1 sell 0.05 GBPUSD at 1.9121 sl: 1.9168 tp: 1.9016 ok

how do I make sense of these bar numbers?

at least the support bars seem somewhat sequential 15,49,205

what's up with the resistance bars? 100,44,109??? for what it's worth looking on the chart the first resistance bar is actually the first in the array of 20 values not 100. Like 1=100??

so in fact the very first two orders did correspond to the bar number for support of 15 bars before the order and if the 100 meant 1 then the resistance did occur on the 1st bar of the 20bar array.