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

The Hidden Pending EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3573
Page 3 of 49
Author:  milanese [ Wed Apr 30, 2014 9:00 am ]
Post subject:  TheHiddenPendingEA

Over60 » Wed Apr 30, 2014 8:48 am wrote:Hi Tommaso,

In advance: I do not know some EA-internals, so I might be wrong.

I tried to use the EA on two charts in the same pair.
One only for short and the other only for long pendings, because I tried to use different SL- and TP-levels.
I did not setup the pending price for long or short vice versa.
The first attached EA did work by default short, but SL- and TP-levels seems to be get lost.
The second EA on the same pair long, attached to a second chart did not work, although it shows in the chart and in the dashboard, that a pending buy-order has been placed.

Independent from this, I got the attached message.
Maybe it has something to do with the internal automatics and/or the setup conditions.
I assume that it could be the ECN fature or a collision between MaxDiffprice and the tighten stop-levels.
If you need more detailed information, please let me know.

By the way, I´d like to ask, why it is not foreseen to enter with a initial order.

Would nice to get some advice.

Regards
Over60
Hi Over 60,

if you set the EA more than one time at the same pair, you should give each instance a different magic number, if you want them not to interact each other. Depending on the broker it could be that your sl and tp levels were to tight.. I can you only strongly recommend to try as broker GlobalPrime as you will with them never have this problems, they do not have any min. distance for your SL or TP and are a 100% trustworthy broker.

Cheers :)

Tommaso
Author:  phil_trade [ Fri May 09, 2014 8:25 am ]
Post subject:  TheHiddenPendingEA

Hello Tommaso

as Spread is only for BUY on Ask, I suggest to modify OnTick() module like this :

Code: Select all

//      if( AllowedSpread(Symbol())==true )
//        {
         RefreshRates();

         if ((SignalBuy==true) && ( AllowedSpread(Symbol())==true ))
           {

               tp=Ask+TP*Point;
               sl=Ask-SL*Point;

               Alert("Attempting to buy ",lotForOrder," of ",Symbol());
               Print("Attempting to buy ",lotForOrder," of ",Symbol());
               
               SendSingleTrade(OP_BUY,"PendingEA",lotForOrder,Ask,sl,tp);
               
           }
         if(SignalSell==true)
           {
           
               tp=Bid-TP*Point;
               sl=Bid+SL*Point;

               Alert("Attempting to sell ",lotForOrder," of ",Symbol());
               Print("Attempting to sell ",lotForOrder," of ",Symbol());
               
               SendSingleTrade(OP_SELL,"PendingEA",lotForOrder,Bid,sl,tp);
             
           }// if (Bid < MonPrixBuy)
//        }// if( AllowedSpread(Symbol())==true )
This will correct a little problem that miss a SELL trade when spread > Average Spread !

Same modification, but for BUY only, in FridayClose module, to avoid a miss BUY close on BID cause spread > average spread

cheers

Philippe
Author:  milanese [ Fri May 09, 2014 8:35 am ]
Post subject:  TheHiddenPendingEA

phil_trade » Fri May 09, 2014 8:25 am wrote:Hello Tommaso

as Spread is only for BUY on Ask, I suggest to modify OnTick() module like this :

Code: Select all

//      if( AllowedSpread(Symbol())==true )
//        {
         RefreshRates();

         if ((SignalBuy==true) && ( AllowedSpread(Symbol())==true ))
           {

               tp=Ask+TP*Point;
               sl=Ask-SL*Point;

               Alert("Attempting to buy ",lotForOrder," of ",Symbol());
               Print("Attempting to buy ",lotForOrder," of ",Symbol());
               
               SendSingleTrade(OP_BUY,"PendingEA",lotForOrder,Ask,sl,tp);
               
           }
         if(SignalSell==true)
           {
           
               tp=Bid-TP*Point;
               sl=Bid+SL*Point;

               Alert("Attempting to sell ",lotForOrder," of ",Symbol());
               Print("Attempting to sell ",lotForOrder," of ",Symbol());
               
               SendSingleTrade(OP_SELL,"PendingEA",lotForOrder,Bid,sl,tp);
             
           }// if (Bid < MonPrixBuy)
//        }// if( AllowedSpread(Symbol())==true )
This will correct a little problem that miss a SELL trade when spread > Average Spread !

Same modification, but for BUY only, in FridayClose module, to avoid a miss BUY close on BID cause spread > average spread

cheers

Philippe
Thanks Philippe, I will change that good spot!

Cheers :)

Tommaso
Author:  phil_trade [ Fri May 09, 2014 9:03 am ]
Post subject:  TheHiddenPendingEA

milanese » 16 minutes ago wrote: Thanks Philippe, I will change that good spot!

Cheers :)

Tommaso

Hey Tommaso....the magician !

could you add a new param, Boolean, Good Trade Only ?

I will be useful to avoid some losses :yahoo:
Author:  milanese [ Fri May 09, 2014 9:09 am ]
Post subject:  [Update]TheHiddenPendingEA

phil_trade » Fri May 09, 2014 9:03 am wrote:
milanese » 16 minutes ago wrote: Thanks Philippe, I will change that good spot!

Cheers :)

Tommaso

Hey Tommaso....the magician !

could you add a new param, Boolean, Good Trade Only ?

I will be useful to avoid some losses :yahoo:
:smile: I am working on a module "LookInFutureFillOnlyIfWillWin", but top secret :xm:
Post 1 updated with the latest version new you find too a new setting MaxSpreadAllowedMultiplicator=1 just set this to value you want the OOTB will only allow to fill the order if the actual spread is not higher as the average spread, setting it to 2 at exp. and the EA will fill the order if the actual spread is not higher as 2 times the average spread..

Cheers:)

Tommaso
Author:  phil_trade [ Fri May 09, 2014 1:58 pm ]
Post subject:  TheHiddenPendingEA

Tommaso

I have an error message when order modify if SL = 0 and TP = xx (30 in my example) -> invalid stop cause SL=BID ?

I have modify EA like this to avoid the bug :

Code: Select all

      tp = 0;
      if (TP>0) tp=Ask+TP*Point;
      
      sl = 0;
      if (SL>0) sl=Ask-SL*Point;
Author:  milanese [ Fri May 09, 2014 2:59 pm ]
Post subject:  TheHiddenPendingEA

phil_trade » Fri May 09, 2014 1:58 pm wrote:Tommaso

I have an error message when order modify if SL = 0 and TP = xx (30 in my example) -> invalid stop cause SL=BID ?

I have modify EA like this to avoid the bug :

Code: Select all

      tp = 0;
      if (TP>0) tp=Ask+TP*Point;
      
      sl = 0;
      if (SL>0) sl=Ask-SL*Point;
:good: Thanks Philippe, yes here I forgot the if (SL!=0) ecc.. as I use it always with SL and TP I will later update the EA in first post

Cheers :)

Tommaso
Author:  milanese [ Fri May 09, 2014 3:06 pm ]
Post subject:  [bugfix!]TheHiddenPendingEA

the bug setting sl/tp=0 causing error 130 is now fixed, thanks again Philippe!
Fixed EA attached in first post

Cheers :)

Tommaso
Author:  Haggadah [ Fri Aug 22, 2014 4:30 pm ]
Post subject:  [bugfix!]TheHiddenPendingEA

milanese » Fri May 09, 2014 4:06 pm wrote:the bug setting sl/tp=0 causing error 130 is now fixed, thanks again Philippe!
Fixed EA attached in first post

Cheers :)

Tommaso

Tommaso,

Make it more user friendly by letting the EA read the current prize and from their will automatically set orders xx pips above/below it.

Good job.

Haggadah
Author:  milanese [ Fri Aug 22, 2014 4:59 pm ]
Post subject:  [NewVersion!]TheHiddenPendingEA

Haggadah » Fri Aug 22, 2014 4:30 pm wrote:
milanese » Fri May 09, 2014 4:06 pm wrote:the bug setting sl/tp=0 causing error 130 is now fixed, thanks again Philippe!
Fixed EA attached in first post

Cheers :)

Tommaso

Tommaso,

Make it more user friendly by letting the EA read the current prize and from their will automatically set orders xx pips above/below it.

Good job.

Haggadah
In the first post you will now find the newest version, new you find this inputs:

Code: Select all

extern bool    SetAutoPendingStopBuy=true;//sets a BuyStop order at Price+ DistancePendingToPrice
extern bool    SetAutoPendingStopSell=true;//sets a SellStop order at Price- DistancePendingToPrice
extern bool    SetAutoPendingLimitBuy=false;//sets a BuyLimit order at Price- DistancePendingToPrice
extern bool    SetAutoPendingLimitSell=false;////sets a SellLimit order at Price+ DistancePendingToPrice
extern double  DistancePendingToPrice=40;//Distance in Pips from actual Price
Thanks for this usefull idea!!

Cheers :)

Tonmaso
All times are UTC Page 3 of 49