Hey traders, I need help with Max Lots.
My platform only allows 99 lots, so i need to set EA for 99 max lots.
Found a couple, but no idea where to place code into EA.
Hey traders, I need help with Max Lots.
My platform only allows 99 lots, so i need to set EA for 99 max lots.
Found a couple, but no idea where to place code into EA.
This is what I have right now,
#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4
#property copyright “Expert Advisor Builder”
#property link “http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/”
extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = True;
extern double LotsMaximum = 2.0; // Describe Maximum Lot Size On Profit Factor.
extern double Lots = 0.02;
extern bool AutoMoneyManagement = false; // percent of accout to risk based on theextern bool
extern double PercentToRisk = 80;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 3000;
extern bool UseTakeProfit = True;
extern int TakeProfit = 20;
extern bool UseTrailingStop = True;
extern int TrailingStop = 15;
extern bool UseHourTrade = False;
extern int FromHourTrade = 8;
extern int ToHourTrade = 17;
extern int TotalTrades = 100;
int BarCount;
int Current;
int TradeCount=0; // used with MAXTrades
bool TickCheck = False;
bool TradeAllowed=true; // used to manage trades
//±-----------------------------------------------------------------+
//| expert initialization function |
//±-----------------------------------------------------------------+
int init() {
if(TradeCount>=TotalTrades)
{
ObjectDelete(“myhalt”);
ObjectCreate(“myhalt”, OBJ_TEXT, 0, Time[40], High[40] );
ObjectSetText(“myhalt”,“OK, Your Done For The Day, Great Job”,24,“Arial”,Red);
return(0);
}
BarCount = Bars;
if (EachTickMode) Current = 0; else Current = 1;
return(0);
}
//±-----------------------------------------------------------------+
//| expert deinitialization function |
//±-----------------------------------------------------------------+
int deinit() {
return(0);
}
//±-----------------------------------------------------------------+
//| expert start function |
//±-----------------------------------------------------------------+
int start()
{
if(TradeCount>=TotalTrades)
{
ObjectDelete(“myhalt”);
ObjectCreate(“myhalt”, OBJ_TEXT, 0, Time[40], High[40] );
ObjectSetText(“myhalt”,“OK, Your Done For The Day, Great Job”,24,“Arial”,Red);
return(0);
}
if (UseHourTrade){
if((Hour()>=FromHourTrade)&&(Hour()<=ToHourTrade))
Comment(“Trading Hours”);
else
{
Comment(“Non-trading Hours”);
return(0);
}
}
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;
double lot=Lots;
double Risk = PercentToRisk / 100;
if (AutoMoneyManagement)
Lots = NormalizeDouble(AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
// and Controlar.
if(TradeCount <= TotalTrades) {TradeAllowed=true; Print("---- TRADEALLOWED ----"); }
if (EachTickMode && Bars != BarCount) TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;
//±-----------------------------------------------------------------+
//| Variable Begin |
//±-----------------------------------------------------------------+
MarketInfo(Symbol(), MODE_MAXLOT);
PS. It would probably be best to learn to code from scratch rather than using an EA builder. Gives you a bit more flexibility.
Hey Clark,
Bro, I dont know where to put it… I tryd to learn, but I just cant grasp it. Like surfing, no balance, cant teach balance, you either have it, or you dont, and I just cant get the coding thing down…
Its a simple EA, well, not varibly, but simple…
This is the last piece of code i need for it to be complete…
I have been trying to place that code chunk, and like 4 others i found, but they all seem complicated, and no-one will explain where to even put the code…
Its tuff to get help with these things…
So do i put it in this line? or another line? I tryed replacing this one, but then i dont get any trades… This EA is a compounder, so the lots gain steam and when it gets to 94 lots, it just stops taking trades…
Lots = Normalize Double(Account Balance()*Risk/Stop Loss/(Market Info(Symbol(), MODE_TICK VALUE)),2);
So, when the EA reaches even 90 lots, i just want it to make 90 lot trades till i stop it, or it runs out of date, ( current day)
Of all people, you always help me, my biggest critic and flamer, I thank you for that.
Have a perfect weekend, and thanks again Clark