Scripts that enter multiple trades off hot keys

free & uncensored discussion arena for TheRumpledOne

Moderator: moderators

User avatar
MarketSlayer
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon Aug 31, 2009 10:57 pm
Reputation: 0
Gender: Male
Contact:

Scripts that enter multiple trades off hot keys

Postby MarketSlayer » Fri Sep 04, 2009 2:16 am

I have attached two simple Scripts I use often that will allow you to Set Hot keys, The code will Blast in Three Market orders with Stop Loss and Take Profits/Limits.
Simply edit the Script and run in Practice account to see how it works.
They work great.
Attachments
SELL 3 Market v1.mq4
Script Enters 3 Sell/Short Orders at Market Price
(2.67 KiB) Downloaded 230 times
BUY 3 Market v1.mq4
Script Enters 3 Buy/Long Orders at Market
(2.74 KiB) Downloaded 219 times
Last edited by MarketSlayer on Sat May 01, 2010 6:03 pm, edited 1 time in total.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
MarketSlayer
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon Aug 31, 2009 10:57 pm
Reputation: 0
Gender: Male
Contact:

Postby MarketSlayer » Sun Sep 27, 2009 10:31 pm

I am getting slippage or when I hit this script, often times I am only getting 1 or 2 of the 3 orders filled.
Does anyone know how to add error checking to retry if all orders are not filled?
Thanks

User avatar
MarketSlayer
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon Aug 31, 2009 10:57 pm
Reputation: 0
Gender: Male
Contact:

Possible solution to Script Orders not filling

Postby MarketSlayer » Mon Oct 05, 2009 1:55 am

//+------------------------------------------------------------------+
I added the order code after the error and that is not fixing it either.
Anyone have any ideas on how to get this to retry until filled when market is busy..What am I missing here??

//| Scalp LONG.mq4 |
//| Copyright ? 2009, |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"

#include <stdlib.mqh>
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| script "trading for all money" |
//+------------------------------------------------------------------+


int start()
{
int ticket_1;
while(true) // Cycle that opens an order
{

Alert("The request was sent to the server. Waiting for reply..");
//---- StopLoss = Ask-20*Point Take Profit = Ask + 20*Point
ticket_1=OrderSend(Symbol(),OP_BUY,0.02,Ask,3,Ask-15*Point,Ask+10*Point,"HOTKEY SCALP LONG",265,0,Green);

//--------------------------------------------------------------------7 --
if (ticket_1>0) // Got it!:)
{
Alert ("Opened Scalp Order Long ",ticket_1);
break; // Exit cycle
}
//--------------------------------------------------------------------8 --
int Error=GetLastError(); // Failed :(
switch(Error) // Overcomable errors
{
case 135:Alert("The price has changed. Retrying..");
RefreshRates(); // Update data
ticket_1=OrderSend(Symbol(),OP_BUY,0.02,Ask,3,Ask-15*Point,Ask+10*Point,"HOTKEY SCALP LONG",265,0,Green);
continue; // At the next iteration
case 136:Alert("No prices. Waiting for a new tick..");
while(RefreshRates()==false) // Up to a new tick
Sleep(1); // Cycle delay
ticket_1=OrderSend(Symbol(),OP_BUY,0.02,Ask,3,Ask-15*Point,Ask+10*Point,"HOTKEY SCALP LONG",265,0,Green);
continue; // At the next iteration
case 146:Alert("Trading subsystem is busy. Retrying..");
Sleep(500); // Simple solution
RefreshRates(); // Update data
ticket_1=OrderSend(Symbol(),OP_BUY,0.02,Ask,3,Ask-15*Point,Ask+10*Point,"HOTKEY SCALP LONG",265,0,Green);
continue; // At the next iteration
}
switch(Error) // Critical errors
{
case 2 : Alert("Common error.");
break; // Exit 'switch'
case 5 : Alert("Outdated version of the client terminal.");
break; // Exit 'switch'
case 64: Alert("The account is blocked.");
break; // Exit 'switch'
case 133:Alert("Trading forbidden");
break; // Exit 'switch'
default: Alert("Occurred error ",Error);// Other alternatives
}
break; // Exit cycle
}

return; // Exit start()
}


//+------------------------------------------------------------------+

User avatar
tmanbone
rank: 500+ posts
rank: 500+ posts
Posts: 723
Joined: Sun Nov 15, 2009 3:52 am
Reputation: 3
Gender: Male

Postby tmanbone » Sun Feb 07, 2010 1:37 am

"The simplicity of the markets is it's greatest disguise"

T

User avatar
tmanbone
rank: 500+ posts
rank: 500+ posts
Posts: 723
Joined: Sun Nov 15, 2009 3:52 am
Reputation: 3
Gender: Male

Postby tmanbone » Mon Feb 08, 2010 6:30 pm

MarketSlayer are you still around? Do these scripts work in demo? I could use some help figuring out what I'm doing wrong. Thank you,

EDIT: Figured it out. Thanks,
"The simplicity of the markets is it's greatest disguise"



T

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
MarketSlayer
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon Aug 31, 2009 10:57 pm
Reputation: 0
Gender: Male
Contact:

Postby MarketSlayer » Sat May 01, 2010 6:05 pm

I updated the original Scripts above, to loop until order is filled, works great.

http://themarketslayer.blogspot.com/201 ... -blog.html

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “TheRumpledOne”