int digits=MarketInfo("EURUSD",MODE_DIGITS); if(digits==5){StopMultd=10;} else{StopMultd=1;}
There are a lot of accounts with added to the currency a prefix or suffix. In that case......
int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,NormalizeDouble(Ask-SL*Point,Digits),NormalizeDouble(Ask+TP*Point,Digits),"psar bug 6 order ",MagicNumber);//Opening Buy int opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slip,NormalizeDouble(Bid+SL*Point,Digits),NormalizeDouble(Bid-TP*Point,Digits),"psar bug 6 order ",MagicNumber);//Opening Sell
Still no coding for working on ECN accounts
//-------------------------------------------------------------------+ //Check open orders //-------------------------------------------------------------------+ if(OrdersTotal()>0){ for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders { if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available { if(OrderMagicNumber()==MagicNumber) {int halt1=1;} } } }
Why not selecting on OrderSymbol and OrderMagicnumber...
With trailing you're not selecting the OrderMagicNumber....
ONLY GOOD FOR BACKTESTING ......
int digits=MarketInfo("EURUSD",MODE_DIGITS); if(digits==5){StopMultd=10;} else{StopMultd=1;}
There are a lot of accounts with added to the currency a prefix or suffix. In that case......
int openbuy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,NormalizeDouble(Ask-SL*Point,Digits),NormalizeDouble(Ask+TP*Point,Digits),"psar bug 6 order ",MagicNumber);//Opening Buy int opensell=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slip,NormalizeDouble(Bid+SL*Point,Digits),NormalizeDouble(Bid-TP*Point,Digits),"psar bug 6 order ",MagicNumber);//Opening Sell
Still no coding for working on ECN accounts
//-------------------------------------------------------------------+ //Check open orders //-------------------------------------------------------------------+ if(OrdersTotal()>0){ for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders { if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available { if(OrderMagicNumber()==MagicNumber) {int halt1=1;} } } }
Why not selecting on OrderSymbol and OrderMagicnumber...
With trailing you're not selecting the OrderMagicNumber....
ONLY GOOD FOR BACKTESTING ......
devries you also might wana read the full psar bug documentation https://www.mql5.com/go?link=http://www.fxautomated.com/docs/psarbugdoc.php to understand this EA better. The magic number is editable by the user making it more flexible thus its enough to only select magic number only and not ordersymbol too since on different charts, timeframes etc the user can set a different magic number afterall thats the work of magic number otherwise i would'nt have made it editable on the user side.
if((Trailing==true)&&(OrdersTotal()>0)){ //----------------------------------------------------------------------------------------------------------------------- // Trail /*-----------------------------------------------------------------------------------------------------------------------*/ string Symb=Symbol(); // Symbol //------------------------------------------------------------------------------- 2 -- for(i=1; i<=OrdersTotal(); i++) // Cycle searching in orders { if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available { // Analysis of orders: int Tip=OrderType(); // Order type if(OrderSymbol()!=Symb||Tip>1)continue;// The order is not "ours" double SLt=OrderStopLoss(); // SL of the selected order //---------------------------------------------------------------------- 3 -- while(true) // Modification cycle { double TS=Tral_Stop; // Initial value int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);//Min. distance if (TS < Min_Dist) // If less than allowed TS=Min_Dist; // New value of TS //------------------------------------------------------------------- 4 -- bool Modify=false; // Not to be modified switch(Tip) // By order type { case 0 : // Order Buy if (NormalizeDouble(SLt,Digits)< // If it is lower than we want NormalizeDouble(Bid-TS*Point,Digits)) { SLt=Bid-TS*Point; // then modify it string Text="Buy "; // Text for Buy Modify=true; // To be modified } break; // Exit 'switch' case 1 : // Order Sell if (NormalizeDouble(SLt,Digits)> // If it is higher than we want NormalizeDouble(Ask+TS*Point,Digits) || NormalizeDouble(SLt,Digits)==0)//or equal to zero { SLt=Ask+TS*Point; // then modify it Text="Sell "; // Text for Sell Modify=true; // To be modified } } // End of 'switch' if (Modify==false) // If it is not modified break; // Exit 'while' //------------------------------------------------------------------- 5 -- double TPt =OrderTakeProfit(); // TP of the selected order double Price =OrderOpenPrice(); // Price of the selected order int Ticket=OrderTicket(); // Ticket of the selected order Alert ("Modification ",Text,Ticket,". Awaiting response.."); bool Ans=OrderModify(Ticket,Price,SLt,TPt,0);//Modify it! //------------------------------------------------------------------- 6 -- if (Ans==true) // Got it! :) { Alert ("Order ",Text,Ticket," is modified:)"); break; // From modification cycle. } //------------------------------------------------------------------- 7 -- break; } // End of modification cycle //---------------------------------------------------------------------- 8 -- } // End of order analysis } // End of order search //------------------------------------------------------------------------------- 9 -- int Error=GetLastError(); // Failed :( switch(Error) // Overcomable errors { case 130:Alert("Wrong stops. Retrying."); RefreshRates(); // Update data // At the next iteration case 136:Alert("No prices. Waiting for a new tick.."); while(RefreshRates()==false) // To the new tick Sleep(1); // Cycle delay // At the next iteration case 146:Alert("Trading subsystem is busy. Retrying "); Sleep(500); // Simple solution RefreshRates(); // Update data // At the next iteration // Critical errors case 2 : Alert("Common error."); // Exit 'switch' case 5 : Alert("Old version of the client terminal."); // Exit 'switch' case 64: Alert("Account is blocked."); // Exit 'switch' case 133:Alert("Trading is prohibited"); // Exit 'switch' default: Alert("Occurred error ",Error);//Other errors } // From modification cycle //------------------------------------------------------------------------------------------------------------------------ // end trail //-------------------------------------------------------------------------------------------------------------------------- }But if you read this code your EA your not selecting Magicnumber with trailing. In this case trades of same currencie found in your orderselect with another magicnumber will be modified by the rules of this EA.... Trie it out if you don't believe me....
Unable to get Psar Bug 7 to work without Manual Confirmation.
My Sar settings match in EA and indicator (Step .03, Max .2)
On platform, Tools ---> Options ---> Unchecked 'Manual Confirmation'
What am I doing wrong?
Thank you.
...cont'd
P.S. I am on a 5-Digit Broker
Hello Tonny,
Unable to get Psar Bug 7 to work without Manual Confirmation.
My Sar settings match in EA and indicator (Step .03, Max .2)
On platform, Tools ---> Options ---> Unchecked 'Manual Confirmation'
What am I doing wrong?
Thank you.
devries you also might wana read the full psar bug documentation https://www.mql5.com/go?link=http://www.fxautomated.com/docs/psarbugdoc.php to understand this EA better. The magic number is editable by the user making it more flexible thus its enough to only select magic number only and not ordersymbol too since on different charts, timeframes etc the user can set a different magic number afterall thats the work of magic number otherwise i would'nt have made it editable on the user side.
if((Trailing==true)&&(OrdersTotal()>0)){ //----------------------------------------------------------------------------------------------------------------------- // Trail /*-----------------------------------------------------------------------------------------------------------------------*/ string Symb=Symbol(); // Symbol //------------------------------------------------------------------------------- 2 -- for(i=1; i<=OrdersTotal(); i++) // Cycle searching in orders { if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available { // Analysis of orders: int Tip=OrderType(); // Order type if(OrderSymbol()!=Symb||Tip>1)continue;// The order is not "ours" double SLt=OrderStopLoss(); // SL of the selected order //---------------------------------------------------------------------- 3 -- while(true) // Modification cycle { double TS=Tral_Stop; // Initial value int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);//Min. distance if (TS < Min_Dist) // If less than allowed TS=Min_Dist; // New value of TS //------------------------------------------------------------------- 4 -- bool Modify=false; // Not to be modified switch(Tip) // By order type { case 0 : // Order Buy if (NormalizeDouble(SLt,Digits)< // If it is lower than we want NormalizeDouble(Bid-TS*Point,Digits)) { SLt=Bid-TS*Point; // then modify it string Text="Buy "; // Text for Buy Modify=true; // To be modified } break; // Exit 'switch' case 1 : // Order Sell if (NormalizeDouble(SLt,Digits)> // If it is higher than we want NormalizeDouble(Ask+TS*Point,Digits) || NormalizeDouble(SLt,Digits)==0)//or equal to zero { SLt=Ask+TS*Point; // then modify it Text="Sell "; // Text for Sell Modify=true; // To be modified } } // End of 'switch' if (Modify==false) // If it is not modified break; // Exit 'while' //------------------------------------------------------------------- 5 -- double TPt =OrderTakeProfit(); // TP of the selected order double Price =OrderOpenPrice(); // Price of the selected order int Ticket=OrderTicket(); // Ticket of the selected order Alert ("Modification ",Text,Ticket,". Awaiting response.."); bool Ans=OrderModify(Ticket,Price,SLt,TPt,0);//Modify it! //------------------------------------------------------------------- 6 -- if (Ans==true) // Got it! :) { Alert ("Order ",Text,Ticket," is modified:)"); break; // From modification cycle. } //------------------------------------------------------------------- 7 -- break; } // End of modification cycle //---------------------------------------------------------------------- 8 -- } // End of order analysis } // End of order search //------------------------------------------------------------------------------- 9 -- int Error=GetLastError(); // Failed :( switch(Error) // Overcomable errors { case 130:Alert("Wrong stops. Retrying."); RefreshRates(); // Update data // At the next iteration case 136:Alert("No prices. Waiting for a new tick.."); while(RefreshRates()==false) // To the new tick Sleep(1); // Cycle delay // At the next iteration case 146:Alert("Trading subsystem is busy. Retrying "); Sleep(500); // Simple solution RefreshRates(); // Update data // At the next iteration // Critical errors case 2 : Alert("Common error."); // Exit 'switch' case 5 : Alert("Old version of the client terminal."); // Exit 'switch' case 64: Alert("Account is blocked."); // Exit 'switch' case 133:Alert("Trading is prohibited"); // Exit 'switch' default: Alert("Occurred error ",Error);//Other errors } // From modification cycle //------------------------------------------------------------------------------------------------------------------------ // end trail //-------------------------------------------------------------------------------------------------------------------------- }But if you read this code your EA your not selecting Magicnumber with trailing. In this case trades of same currencie found in your orderselect with another magicnumber will be modified by the rules of this EA.... Trie it out if you don't believe me....
Actually this ea works better without trailing i just added it there as an option because of a user requested it and this is why i prefer handling personal customisations separately.
Hi Tonny,
Yes, under 'Common Tab' I have 'Live Trading' checked and 'Manual Confirmation' unchecked.
I tested it on the 1M and 5M GBP/USD charts, no orders are opening automatically, no error messages in Journal.
Works perfectly with Manual Confirmation though. Any other suggestions, please let me know...
Thanks
Hello Tonny,
Unable to get Psar Bug 7 to work without Manual Confirmation.
My Sar settings match in EA and indicator (Step .03, Max .2)
On platform, Tools ---> Options ---> Unchecked 'Manual Confirmation'
What am I doing wrong?
Thank you.
Hi Tonny,
Yes, under 'Common Tab' I have 'Live Trading' checked and 'Manual Confirmation' unchecked.
I tested it on the 1M and 5M GBP/USD charts, no orders are opening automatically, no error messages in Journal.
Works perfectly with Manual Confirmation though. Any other suggestions, please let me know...
Thanks
Hello Tonny,
Unable to get Psar Bug 7 to work without Manual Confirmation.
My Sar settings match in EA and indicator (Step .03, Max .2)
On platform, Tools ---> Options ---> Unchecked 'Manual Confirmation'
What am I doing wrong?
Thank you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
psar bug 7:
Author: Tonny Obare