• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 5:38am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 5:38am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Drag&Drop buy limit and sell limit scripts 1 reply

Trailing Stop Settings for Intraday settings? 3 replies

Scripts To buy, sell 2 replies

Can anyone share Buy-Sell-Close scripts to use as a hotkey without using F9 option? 5 replies

Buy-Sell-Close scripts ? 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 2
Attachments: Smjones' Buy & Sell Scripts with BE settings
Exit Attachments
Tags: Smjones' Buy & Sell Scripts with BE settings
Cancel

Smjones' Buy & Sell Scripts with BE settings

  • Post #1
  • Quote
  • First Post: Jul 24, 2011 1:19pm Jul 24, 2011 1:19pm
  •  Flava
  • | Joined Jul 2010 | Status: Member | 30 Posts
I came across one of smjones' scripts that works like a buy or sell limit order that sets SL & TP. Would really appreciate if someone can add a 'move stop to break even' setting. eg....

extern string BE="Break even settings";
extern bool BreakEven = false;
extern int BreakEvenPips = 15;
extern int BreakEvenProfit = 2;

If you're really bored a trailing stop option would be nice also
Attached File(s)
File Type: mq4 Buy EA.mq4   2 KB | 255 downloads
File Type: mq4 Sell EA.mq4   2 KB | 228 downloads
  • Post #2
  • Quote
  • Jul 24, 2011 3:22pm Jul 24, 2011 3:22pm
  •  Flava
  • | Joined Jul 2010 | Status: Member | 30 Posts
Will this work for BUY? I have no Idea what I'm doing. I stole some code from Steve's 'Multi Purpose Trade Manager' script...

//+------------------------------------------------------------------+
//| Buy with SL and TP |
//| Copyright 2008, smjones |
//| sjcoinc |
//+------------------------------------------------------------------+
#property copyright "Copyright 2008, smjones"
#property link "[email protected]"


#property show_inputs

extern double Lots = 1;
extern bool UseMoneyMgmt = true;
extern double RiskPercent = 2;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 300;
extern double TakeProfit = 300;
extern string BE = "Break even settings";
extern bool BreakEven = true;
extern int BreakEvenPips = 150;
extern int BreakEvenProfit = 20;
extern string Note = "0 in Entry field means Market Order Buy";
extern double Entry = 0.00100;

string Input = " Buy Price ";



//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Buy Script", 0, NULL, LimeGreen);

return(0);

if (Bid >= OrderOpenPrice () + (Point*BreakEvenPips) && OrderStopLoss()<OrderOpenPrice())
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(BreakEvenProfit*Point),OrderTakeProfit(),0,CLR_NONE);
}
//+------------------------------------------------------------------+




All I added was:

if (Bid >= OrderOpenPrice () + (Point*BreakEvenPips) && OrderStopLoss()<OrderOpenPrice())
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(BreakEvenProfit*Point),OrderTakeProfit(),0,CLR_NONE);
 
 
  • Post #3
  • Quote
  • Last Post: Jul 24, 2011 4:13pm Jul 24, 2011 4:13pm
  •  Flava
  • | Joined Jul 2010 | Status: Member | 30 Posts
Apparently I'm an idiot. I just realized the files I attached are scripts not EA's so a 'move stop to break even' function won't work. So I've decided I'll use the scripts as is and use Steve's 'Multi Purpose Trade Manager EA' to auto move my stops to BE at my desired level.

Easy Peasy.
 
 
  • Platform Tech
  • /
  • Smjones' Buy & Sell Scripts with BE settings
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023