The Hidden Pending EA

MPTM's new home
Post Reply
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TheHiddenPendingEA

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
phil_trade

TheHiddenPendingEA

Post by phil_trade »

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
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TheHiddenPendingEA

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
phil_trade

TheHiddenPendingEA

Post by phil_trade »

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:
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

[Update]TheHiddenPendingEA

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
phil_trade

TheHiddenPendingEA

Post by phil_trade »

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;
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

TheHiddenPendingEA

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

[bugfix!]TheHiddenPendingEA

Post by milanese »

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

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Haggadah
Trader
Posts: 154
Joined: Sat Dec 03, 2011 12:01 pm

[bugfix!]TheHiddenPendingEA

Post by Haggadah »

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
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

[NewVersion!]TheHiddenPendingEA

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Post Reply

Return to “Utilities Indicators and Scripts”