Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //datetime Globalflag1 = GlobalVariableSet("LotsResStr1", NormalizeDouble(GlobalVariableGet("LotsResStr1"),2));
- //datetime Globalflag2 = GlobalVariableSet("LotsResStr2", NormalizeDouble(GlobalVariableGet("LotsResStr2"),2));
- //datetime Globalflag3 = GlobalVariableSet("LotsResStr3", NormalizeDouble(GlobalVariableGet("LotsResStr3"),2));
- //datetime Globalflag4 = GlobalVariableSet("LotsResStr4", NormalizeDouble(GlobalVariableGet("LotsResStr4"),2));
- //datetime Globalflag5 = GlobalVariableSet("LotsResStr5", NormalizeDouble(GlobalVariableGet("LotsResStr5"),2));
- //datetime Globalflag6 = GlobalVariableSet("TakeProfitResStr1", GlobalVariableGet("TakeProfitResStr1"));
- //datetime Globalflag7 = GlobalVariableSet("TakeProfitResStr2", GlobalVariableGet("TakeProfitResStr2"));
- //datetime Globalflag8 = GlobalVariableSet("TakeProfitResStr3", GlobalVariableGet("TakeProfitResStr3"));
- //datetime Globalflag9 = GlobalVariableSet("TakeProfitResStr4", GlobalVariableGet("TakeProfitResStr4"));
- //datetime Globalflag10 = GlobalVariableSet("TakeProfitResStr5", GlobalVariableGet("TakeProfitResStr5"));
- //datetime Globalflag11 = GlobalVariableSet("StopLossResStr1", GlobalVariableGet("StopLossResStr1"));
- //datetime Globalflag12 = GlobalVariableSet("StopLossResStr2", GlobalVariableGet("StopLossResStr2"));
- //datetime Globalflag13 = GlobalVariableSet("StopLossResStr3", GlobalVariableGet("StopLossResStr3"));
- //datetime Globalflag14 = GlobalVariableSet("StopLossResStr4", GlobalVariableGet("StopLossResStr4"));
- //datetime Globalflag15 = GlobalVariableSet("StopLossResStr5", GlobalVariableGet("StopLossResStr5"));
- #property copyright "Copyright 2015, MetaQuotes Software Corp."
- #property link "https://www.mql5.com"
- #property version "1.00"
- #property strict
- string DrawInfo(string ProfileStr, int ProfileRes, string LotsStr, double LotsResStr, string TakeProfitStr, double TakeProfitResStr, string StopLossStr, double StopLossResStr, string LockStr)
- {
- return(StringConcatenate(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- string KeyInt(const long &lparam, string StrVar)
- {
- if (lparam == 49)
- {
- StringAdd(StrVar, "1");
- return(StrVar);
- }
- if (lparam == 50)
- {
- StringAdd(StrVar, "2");
- return(StrVar);
- }
- if (lparam == 51)
- {
- StringAdd(StrVar, "3");
- return(StrVar);
- }
- if (lparam == 52)
- {
- StringAdd(StrVar, "4");
- return(StrVar);
- }
- if (lparam == 53)
- {
- StringAdd(StrVar, "5");
- return(StrVar);
- }
- if (lparam == 54)
- {
- StringAdd(StrVar, "6");
- return(StrVar);
- }
- if (lparam == 55)
- {
- StringAdd(StrVar, "7");
- return(StrVar);
- }
- if (lparam == 56)
- {
- StringAdd(StrVar, "8");
- return(StrVar);
- }
- if (lparam == 57)
- {
- StringAdd(StrVar, "9");
- return(StrVar);
- }
- if (lparam == 48)
- {
- StringAdd(StrVar, "0");
- return(StrVar);
- }
- if (lparam == 46)
- {
- StrVar = "";
- return(StrVar);
- }
- if (lparam == 190)
- {
- StringAdd(StrVar, ".");
- return(StrVar);
- }
- return(StrVar);
- }
- bool Buffer = false;
- string Key = "";
- int Lock = 1;
- string LockStr = "\nLOCKED";
- string LotsStr = " \nLots: ";
- string LotsResStr = "";
- int ProfileRes = GlobalVariableGet("ProfileRes");
- string ProfileStr = "Profile: ";
- int Selector = 1;
- string StopLossStr = " \nStop Loss: ";
- string StopLossResStr = "";
- string TakeProfitStr = " \nTake Profit: ";
- string TakeProfitResStr = "";
- int Ticket = 0;
- int OnInit()
- {
- LotsResStr = GlobalVariableGet(StringConcatenate("LotsResStr", ProfileRes ));
- TakeProfitResStr = GlobalVariableGet(StringConcatenate("TakeProfitResStr", ProfileRes ));
- StopLossResStr = GlobalVariableGet(StringConcatenate("StopLossResStr", ProfileRes ));
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet(StringConcatenate("LotsResStr", ProfileRes )));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet(StringConcatenate("TakeProfitResStr", ProfileRes )));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet(StringConcatenate("StopLossResStr", ProfileRes )));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- if (ProfileRes == 1)
- {
- datetime GlobalFlag16 = GlobalVariableSet("ProfileRes", 1);
- }
- if (ProfileRes == 2)
- {
- datetime GlobalFlag17 = GlobalVariableSet("ProfileRes", 2);
- }
- if (ProfileRes == 3)
- {
- datetime GlobalFlag18 = GlobalVariableSet("ProfileRes", 3);
- }
- if (ProfileRes == 4)
- {
- datetime GlobalFlag19 = GlobalVariableSet("ProfileRes", 4);
- }
- if (ProfileRes == 5)
- {
- datetime GlobalFlag20 = GlobalVariableSet("ProfileRes", 5);
- }
- ProfileStr = "-> Profile: ";
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- return(INIT_SUCCEEDED);
- }
- void OnTimer()
- {
- Buffer = false;
- Key = "";
- EventKillTimer();
- }
- void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
- {
- if (id == CHARTEVENT_KEYDOWN && Buffer == false)
- {
- Print("Key: ", lparam);
- Buffer = true;
- EventKillTimer();
- EventSetMillisecondTimer(50);
- if (lparam == "16")
- {
- Key = "Shift";
- }
- if (lparam == "87")
- {
- Key = "W";
- }
- if (lparam == "65")
- {
- Key = "A";
- }
- if (lparam == "83")
- {
- Key = "S";
- }
- if (lparam == "68")
- {
- Key = "D";
- }
- if (lparam == "81")
- {
- Key = "Q";
- }
- if (lparam == "69")
- {
- Key = "E";
- }
- if (Key == "Shift")
- {
- Lock = !Lock;
- if (Lock == 0)
- {
- LockStr = "\nUNLOCKED";
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (Lock == 1)
- {
- LockStr = "\nLOCKED";
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- }
- if (Key == "Q" && Lock == 0)
- {
- Ticket = OrderSend(Symbol(), OP_BUY, GlobalVariableGet("ActiveLotsRes"), Ask, 1000, GlobalVariableGet("ActiveStopLossRes"), GlobalVariableGet("ActiveTakeProfitRes"));
- Print(Ticket);
- }
- if (Key == "E" && Lock == 0)
- {
- Ticket = OrderSend(Symbol(), OP_SELL, GlobalVariableGet("ActiveLotsRes"), Bid, 1000, GlobalVariableGet("ActiveStopLossRes"), GlobalVariableGet("ActiveTakeProfitRes"));
- Print(Ticket);
- }
- if (Key == "W" && Lock == 0 && Selector > 1)
- {
- Selector--;
- }
- if (Key == "S" && Lock == 0 && Selector < 4)
- {
- Selector++;
- }
- if (Selector == 1)
- {
- ProfileStr = "-> Profile: ";
- LotsStr = " \nLots: ";
- TakeProfitStr = " \nTake Profit: ";
- StopLossStr = " \nStop Loss: ";
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- if (Key == "D" && Lock == 0 && ProfileRes < 5)
- {
- ProfileRes++;
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (Key == "A" && Lock == 0 && ProfileRes > 1)
- {
- ProfileRes--;
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- }
- if (Selector == 2)
- {
- ProfileStr = "Profile: ";
- LotsStr = " \n-> Lots: ";
- TakeProfitStr = " \nTake Profit: ";
- StopLossStr = " \nStop Loss: ";
- LotsResStr = KeyInt(lparam, LotsResStr);
- if (ProfileRes == 1)
- {
- GlobalVariableSet("LotsResStr1", LotsResStr);
- }
- if (ProfileRes == 2)
- {
- GlobalVariableSet("LotsResStr2", LotsResStr);
- }
- if (ProfileRes == 3)
- {
- GlobalVariableSet("LotsResStr3", LotsResStr);
- }
- if (ProfileRes == 4)
- {
- GlobalVariableSet("LotsResStr4", LotsResStr);
- }
- if (ProfileRes == 5)
- {
- GlobalVariableSet("LotsResStr5", LotsResStr);
- }
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (Selector == 3)
- {
- ProfileStr = "Profile: ";
- LotsStr = " \nLots: ";
- TakeProfitStr = " \n-> Take Profit: ";
- StopLossStr = " \nStop Loss: ";
- TakeProfitResStr = KeyInt(lparam, TakeProfitResStr);
- if (ProfileRes == 1)
- {
- GlobalVariableSet("TakeProfitResStr1", TakeProfitResStr);
- }
- if (ProfileRes == 2)
- {
- GlobalVariableSet("TakeProfitResStr2", TakeProfitResStr);
- }
- if (ProfileRes == 3)
- {
- GlobalVariableSet("TakeProfitResStr3", TakeProfitResStr);
- }
- if (ProfileRes == 4)
- {
- GlobalVariableSet("TakeProfitResStr4", TakeProfitResStr);
- }
- if (ProfileRes == 5)
- {
- GlobalVariableSet("TakeProfitResStr5", TakeProfitResStr);
- }
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (Selector == 4)
- {
- ProfileStr = "Profile: ";
- LotsStr = " \nLots: ";
- TakeProfitStr = " \nTake Profit: ";
- StopLossStr = " \n-> Stop Loss: ";
- StopLossResStr = KeyInt(lparam, StopLossResStr);
- if (ProfileRes == 1)
- {
- GlobalVariableSet("StopLossResStr1", StopLossResStr);
- }
- if (ProfileRes == 2)
- {
- GlobalVariableSet("StopLossResStr2", StopLossResStr);
- }
- if (ProfileRes == 3)
- {
- GlobalVariableSet("StopLossResStr3", StopLossResStr);
- }
- if (ProfileRes == 4)
- {
- GlobalVariableSet("StopLossResStr4", StopLossResStr);
- }
- if (ProfileRes == 5)
- {
- GlobalVariableSet("StopLossResStr5", StopLossResStr);
- }
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (Key == "A" || Key == "D")
- {
- if (ProfileRes == 1)
- {
- datetime GlobalFlag16 = GlobalVariableSet("ProfileRes", 1);
- LotsResStr = GlobalVariableGet("LotsResStr1");
- TakeProfitResStr = GlobalVariableGet("TakeProfitResStr1");
- StopLossResStr = GlobalVariableGet("StopLossResStr1");
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet("LotsResStr1"));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet("TakeProfitResStr1"));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet("StopLossResStr1"));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (ProfileRes == 2)
- {
- datetime GlobalFlag17 = GlobalVariableSet("ProfileRes", 2);
- LotsResStr = GlobalVariableGet("LotsResStr2");
- TakeProfitResStr = GlobalVariableGet("TakeProfitResStr2");
- StopLossResStr = GlobalVariableGet("StopLossResStr2");
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet("LotsResStr2"));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet("TakeProfitResStr2"));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet("StopLossResStr2"));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (ProfileRes == 3)
- {
- datetime GlobalFlag18 = GlobalVariableSet("ProfileRes", 3);
- LotsResStr = GlobalVariableGet("LotsResStr3");
- TakeProfitResStr = GlobalVariableGet("TakeProfitResStr3");
- StopLossResStr = GlobalVariableGet("StopLossResStr3");
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet("LotsResStr3"));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet("TakeProfitResStr3"));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet("StopLossResStr3"));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (ProfileRes == 4)
- {
- datetime GlobalFlag19 = GlobalVariableSet("ProfileRes", 4);
- LotsResStr = GlobalVariableGet("LotsResStr4");
- TakeProfitResStr = GlobalVariableGet("TakeProfitResStr4");
- StopLossResStr = GlobalVariableGet("StopLossResStr4");
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet("LotsResStr4"));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet("TakeProfitResStr4"));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet("StopLossResStr4"));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- if (ProfileRes == 5)
- {
- datetime GlobalFlag20 = GlobalVariableSet("ProfileRes", 5);
- LotsResStr = GlobalVariableGet("LotsResStr5");
- TakeProfitResStr = GlobalVariableGet("TakeProfitResStr5");
- StopLossResStr = GlobalVariableGet("StopLossResStr5");
- GlobalVariableSet("ActiveLotsRes",GlobalVariableGet("LotsResStr5"));
- GlobalVariableSet("ActiveTakeProfitRes",GlobalVariableGet("TakeProfitResStr5"));
- GlobalVariableSet("ActiveStopLossRes",GlobalVariableGet("StopLossResStr5"));
- Comment(DrawInfo(ProfileStr, ProfileRes, LotsStr, LotsResStr, TakeProfitStr, TakeProfitResStr, StopLossStr, StopLossResStr, LockStr));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement