这个脚本是拖到图标里的一个位置,这个位置就是你的止损位
会弹出确认窗口,可以调整止损百分比
请高人给增加一项自动添加止盈,止盈也可以在窗口调整,默认是止损的2倍
这样就把止盈止损一次都设置好了
看到别人有发过一个类似的图
//+——————————————————————+
//| 3!!_Super挂单脚本.mq4 |
//| |
//+——————————————————————+
#property copyright “”
#property link “”
#property show_inputs
#include
extern double Risk = 0.02;
//+——————————————————————+
//| script program start function |
//+——————————————————————+
int start()
{
//—-
double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);
double Step = MarketInfo(Symbol(), MODE_LOTSTEP);
double StopLoss = WindowPriceOnDropped();
double MoneyRisk = AccountFreeMargin() * Risk;
double TickValue = MarketInfo(Symbol(), MODE_TICKVALUE);
double PointLoss;
int cmd;
double price;
if(Ask>StopLoss)
{
//Open Long
PointLoss = (Ask – StopLoss) / Point;
cmd = OP_BUY;
price = Ask;
}
else
{
//Open Short
PointLoss = (StopLoss – Bid) / Point;
cmd = OP_SELL;
price = Bid;
}
double LotsRough = MoneyRisk / (TickValue * PointLoss);
if(LotsRough<MinLot)
{
Print(“Error. You don’t have enough money!”);
return(0);
}
double Lots = MaxLot;
for(double CheckedLot=MinLot; CheckedLot<=MaxLot; CheckedLot+=Step)
{
if(CheckedLot>LotsRough)
{
Lots = CheckedLot – Step;
break;
}
}
Print(“Lots=”,Lots);
int ticket = OrderSend(Symbol(), cmd, Lots, price, 3, StopLoss, 0);
if (ticket<0)
{
Print(“Error: “, ErrorDescription(GetLastError()));
}
//—-
return(0);
}
//+——————————————————————+