Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-15-2006, 09:29 PM
sadaloma's Avatar
sadaloma sadaloma is offline
Senior Member
 
Join Date: Sep 2005
Posts: 343
sadaloma is on a distinguished road
Script for buy/sell

Hi,

There is a script available in MT4 called trade.mq4 that open a "buy" position.

Could someone help me configure this script? What I want is a simple change of value. I don't want it to have a pop up configurable settings window because I just want to drag and drop the script at a currency window and have my trade open up instantly without having to input anything.

My idea is to create numerous script with different settings.

for example:

- 1 script with BUY TP 20, SL 35,TS 15
- 1 script with SELL TP 20, SL 35,TS 15
- etc

The code of trade.mq4:

Code:
//+------------------------------------------------------------------+
//|                                                        trade.mq4 |
//|                      Copyright  2004, MetaQuotes Software Corp. |
//|                                       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()
  {
//----
   if(MessageBox("Do you really want to BUY 1.00 "+Symbol()+" at ASK price?    ",
                 "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1);

  
   double                        ts, tp, sl;
   double                        TrailingStop;
   double                        TakeProfit;
   double                        InitialStopLoss;

   {
    
      TrailingStop = 40;
      TakeProfit = 72;
      InitialStopLoss=52;
   } 
   
   int ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,CLR_NONE);
   if(ticket<1)
     {
      int error=GetLastError();
      Print("Error = ",ErrorDescription(error));
      return;
     }
//----
   OrderPrint();
   return(0);
  }
//+------------------------------------------------------------------+


I tried changing around the values but I always get invalid stops.
What should I change to be able to get the values I want to configure?

Thank you in advance for your help.

Sada
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-15-2006, 10:40 PM
beerhunter's Avatar
beerhunter beerhunter is offline
Member
 
Join Date: Nov 2005
Posts: 43
beerhunter is on a distinguished road
Hi Sada!

I wrote this script, but please be aware that I'm not a professional programmer:

It's for BUY order:
Attached Files
File Type: mq4 Buy Now!.mq4 (1.4 KB, 133 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-15-2006, 11:54 PM
sadaloma's Avatar
sadaloma sadaloma is offline
Senior Member
 
Join Date: Sep 2005
Posts: 343
sadaloma is on a distinguished road
Thanks Beerhunter,

I modified the TP&SL to my liking and created a sell script too,it worked like a charm.

Sada
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-4/797-script-buy-sell.html
Posted By For Type Date
MQL - صفحه 6 - Sarmaye Forums This thread Refback 07-09-2007 02:22 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Don't SELL, just BUY it indratime Suggestions for Trading Systems 24 06-18-2007 11:23 PM
A Simple Buy/Sell Script excite2 Expert Advisors - Metatrader 4 8 07-18-2006 03:16 AM
Sell here your EA ;) forexts Commercial Trading Systems and indicators 0 11-30-2005 03:46 PM


All times are GMT. The time now is 10:30 PM.