├── assets └── screenshot.png ├── include ├── Expert │ ├── logo.ico │ └── Trading Panel.mq5 ├── TradingAgent.mqh ├── TradingHelper.mqh ├── TrailingStop.mqh └── TradingPanel.mqh ├── README.md └── LICENSE /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/assets/screenshot.png -------------------------------------------------------------------------------- /include/Expert/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/include/Expert/logo.ico -------------------------------------------------------------------------------- /include/TradingAgent.mqh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/include/TradingAgent.mqh -------------------------------------------------------------------------------- /include/TradingHelper.mqh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/include/TradingHelper.mqh -------------------------------------------------------------------------------- /include/TrailingStop.mqh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/include/TrailingStop.mqh -------------------------------------------------------------------------------- /include/Expert/Trading Panel.mq5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kashu7100/TradingPanel/HEAD/include/Expert/Trading Panel.mq5 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TradingPanel 2 |

3 | 4 |

5 | 6 | ## Installation 7 | Copy all contents in `include` to `Data Folder/MQL5/Include` then compile with MetaEditor (F7). Then move `Trading Panel.ex5` to `Data Folder/MQL5/Experts`. 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /include/TradingPanel.mqh: -------------------------------------------------------------------------------- 1 | //+------------------------------------------------------------------+ 2 | //| TradingPanel.mqh | 3 | //| Copyright 2018, Kashu Yamazaki, All Rights Reserved. | 4 | //| https://Kashu7100.github.io | 5 | //+------------------------------------------------------------------+ 6 | #property copyright "Copyright 2018, Kashu" 7 | #property strict 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #resource "\\Include\\Controls\\res\\CheckBoxOn.bmp" 16 | #resource "\\Include\\Controls\\res\\CheckBoxOff.bmp" 17 | #resource "\\Include\\Controls\\res\\SpinInc.bmp" 18 | #resource "\\Include\\Controls\\res\\SpinDec.bmp" 19 | 20 | enum ENUM_LABEL_ALIGN{ 21 | LEFT = -1, 22 | CENTER = 0, 23 | RIGHT = 1 24 | }; 25 | 26 | class TradingPanel:public CAppDialog{ 27 | public: 28 | void TradingPanel(int accountNum,ENUM_POSITION_HANDLING position_handling=LONG_SHORT, bool autoTrailing=true, double startSL=15, 29 | double basic_SLwidth=10, double risk=4, double SL=15, double TP=30); 30 | void ~TradingPanel(); 31 | bool Init(int accountNum,ENUM_POSITION_HANDLING position_handling=LONG_SHORT,bool autoTrailing=true,double startSL=15.000000, 32 | double basic_SLwidth=10.000000,double risk=4, double SL=15, double TP=30); 33 | 34 | virtual bool Create(const string name, const int x1=5,const int y1=20,const int x2=320,const int y2=420); 35 | virtual void Update(void); 36 | void OnTime(void); 37 | virtual bool OnEvent(const int id,const long &lparam, const double &dparam, const string &sparam); 38 | 39 | private: 40 | bool CreateLabel(CLabel &object, const string text, const uint x, const uint y, ENUM_LABEL_ALIGN align); 41 | bool CreateEdit(CEdit &object,const string text,const uint x,const uint y,const uint x_size,const uint y_size); 42 | bool CreateBmpButton(CBmpButton &object,const uint x,const uint y,string BmpON,string BmpOFF,bool lock); 43 | bool CreateButton(CButton &object,const string text,const uint x,const uint y,const uint x_size,const uint y_size); 44 | bool CreateComboBox(CComboBox &object,const uint x,const uint y,const uint x_size,const uint y_size); 45 | 46 | // On Event 47 | void Edit_Lots(void); 48 | void Edit_Amount(void); 49 | void Edit_SL(void); 50 | void Edit_TP(void); 51 | void Click_AutoLots(void); 52 | void Click_FixVolume(void); 53 | void Click_SL(void); 54 | void Click_TP(void); 55 | void Click_Trailing(void); 56 | void Click_IncreaseLots(void); 57 | void Click_DecreaseLots(void); 58 | void Click_IncreaseAmount(void); 59 | void Click_DecreaseAmount(void); 60 | void Click_IncreaseSL(void); 61 | void Click_DecreaseSL(void); 62 | void Click_IncreaseTP(void); 63 | void Click_DecreaseTP(void); 64 | void Click_OrderSell(void); 65 | void Click_OrderCross(void); 66 | void Click_OrderBuy(void); 67 | void Click_CloseAllSell(void); 68 | void Click_CloseAll(void); 69 | void Click_CloseAllBuy(void); 70 | 71 | protected: 72 | CLabel mAsk_value, mSpread_value, mBid_value; // Display Ask and Bid prices 73 | CLabel mFixVolume_label, mAmount_label; // 74 | CLabel mAutoLots_label, mLots1_label; // 75 | CLabel mAutoSL_label, mSL_label; // 76 | CLabel mAutoTP_label, mTP_label; // 77 | CLabel mAllowTrailing_label, mTrailingType_label; // 78 | CLabel mSellPositions_value, mPositions_label, mBuyPositions_value;// 79 | CLabel mSellLots_value, mLots2_label, mBuyLots_value; // 80 | CLabel mSellBE_value, mBE_label, mBuyBE_value; // 81 | CLabel mSellProfit_value, mProfit_label, mBuyProfit_value; // 82 | CLabel mEquity_label, mEquity_value; // 83 | CLabel mMarginLevel_label, mMarginLevel_value; // 84 | CLabel mLeverage_label, mLeverage_value; // 85 | CComboBox mTrailingType_box; // 86 | CEdit mAmount_input; // 87 | CEdit mLots_input; // 88 | CEdit mSL_input; // 89 | CEdit mTP_input; // 90 | CBmpButton mAutoLots_button, mFixVolume_button; // 91 | CBmpButton mAutoSL_button, mSL_button; // 92 | CBmpButton mAutoTP_button, mTP_button; // 93 | CBmpButton mTrailing_button; // 94 | CBmpButton mIncreaseAmount_button, mDecreaseAmount_button; // Increase and Decrease buttons 95 | CBmpButton mIncreaseLots_button, mDecreaseLots_button; // Increase and Decrease buttons 96 | CBmpButton mIncreaseSL_button, mDecreaseSL_button; // Increase and Decrease buttons 97 | CBmpButton mIncreaseTP_button, mDecreaseTP_button; // Increase and Decrease buttons 98 | CButton mOrderSell_button, mOrderCross_button, mOrderBuy_button; // Sell, Cross, and Buy Buttons 99 | CButton mCloseAllSell_button, mCloseAll_button, mCloseAllBuy_button;// Close buttons 100 | 101 | uint mAmount; 102 | double mLots; 103 | bool mFixVolume; 104 | double mSL; // [pips] 105 | double mTP; // [pips] 106 | bool mEnable_SL; 107 | bool mEnable_TP; 108 | bool mEnable_Trailing; 109 | TradingAgent mTA; 110 | 111 | #define STEP (int)(ClientAreaHeight()/18/4) // height step betwine elements 112 | #define HEIGHT (int)(ClientAreaHeight()/18) // height of element 113 | #define BORDER (int)(ClientAreaHeight()/24) // distance betwine boder and elements 114 | }; 115 | 116 | TradingPanel::TradingPanel(int accountNum,ENUM_POSITION_HANDLING position_handling=LONG_SHORT, bool autoTrailing=true, double startSL=15, 117 | double basic_SLwidth=10, double risk=4, double sl=15, double tp=30){ 118 | mSL = sl; 119 | mTP = tp; 120 | mTA.Init(accountNum, "", 12345, NONE, LONG_AND_SHORT, position_handling, true, 0.01, autoTrailing, startSL, basic_SLwidth, risk, 0, 0); 121 | } 122 | 123 | TradingPanel::~TradingPanel(void){ 124 | } 125 | 126 | bool TradingPanel::Init(int accountNum,ENUM_POSITION_HANDLING position_handling=LONG_SHORT,bool autoTrailing=true,double startSL=15.000000, 127 | double basic_SLwidth=10.000000,double risk=4, double sl=15, double tp=30){ 128 | mSL = sl; 129 | mTP = tp; 130 | return mTA.Init(accountNum, "", 12345, NONE, LONG_AND_SHORT, position_handling, true, 0.01, autoTrailing, startSL, basic_SLwidth, risk, 0, 0); 131 | } 132 | 133 | bool TradingPanel::Create(const string name, const int x1=5,const int y1=20,const int x2=320,const int y2=420){ 134 | if(!Create(0,name,0,x1,y1,x2,y2)) return false; 135 | int l_x_left=BORDER; 136 | int l_y=BORDER; 137 | int y_width=HEIGHT; 138 | int y_sptep=STEP; 139 | 140 | if(!CreateLabel(mBid_value,DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits),l_x_left,l_y,LEFT)) return false; 141 | if(!mBid_value.FontSize(HEIGHT-3)) return false; 142 | mBid_value.Color(clrRed); 143 | 144 | int l_x_right=ClientAreaWidth()-20; 145 | 146 | if(!CreateLabel(mSpread_value,DoubleToString((SymbolInfoDouble(_Symbol,SYMBOL_ASK)-SymbolInfoDouble(_Symbol,SYMBOL_BID))/_Point,0),l_x_right-137.5,l_y,CENTER)) return false; 147 | if(!mSpread_value.FontSize(HEIGHT-4)) return false; 148 | if(!CreateLabel(mAsk_value,DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits),l_x_right,l_y,RIGHT)) return false; 149 | if(!mAsk_value.FontSize(HEIGHT-3)) return false; 150 | mAsk_value.Color(clrBlue); 151 | 152 | l_y+=2*HEIGHT; 153 | int x_size=(int)((ClientAreaWidth()-40)/3-5); 154 | 155 | // Order Send Buttons 156 | if(!CreateButton(mOrderSell_button,"SELL",l_x_left,l_y,x_size,HEIGHT*2)) return false; 157 | if(!CreateButton(mOrderCross_button,"CROSS",(l_x_right-l_x_left-x_size)/2+l_x_left,l_y,x_size,HEIGHT*2)) return false; 158 | if(!CreateButton(mOrderBuy_button,"BUY",(l_x_right-x_size),l_y,x_size,HEIGHT*2)) return false; 159 | 160 | l_y+=2*HEIGHT+STEP; 161 | if(!CreateBmpButton(mAutoLots_button,l_x_left+15,l_y,"::Include\\Controls\\res\\CheckBoxOn.bmp","::Include\\Controls\\res\\CheckBoxOff.bmp",true)) return false; 162 | if(!CreateLabel(mAutoLots_label,"AutoLots",l_x_left+20,l_y,LEFT)) return false; 163 | 164 | if(!CreateLabel(mLots1_label,"Volume [lots]",l_x_right-2.1*x_size,l_y,LEFT)) return false; 165 | if(!CreateEdit(mLots_input,SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN),l_x_right-x_size,l_y,(int)(x_size-CONTROLS_BUTTON_SIZE),HEIGHT)) return false; 166 | if(!CreateBmpButton(mIncreaseLots_button,l_x_right,(int)(l_y-HEIGHT/4),"::Include\\Controls\\res\\SpinInc.bmp","::Include\\Controls\\res\\SpinInc.bmp",false)) return false; 167 | if(!CreateBmpButton(mDecreaseLots_button,l_x_right,(int)(l_y+HEIGHT/4),"::Include\\Controls\\res\\SpinDec.bmp","::Include\\Controls\\res\\SpinDec.bmp",false)) return false; 168 | 169 | l_y+=HEIGHT+STEP; 170 | if(!CreateBmpButton(mFixVolume_button,l_x_left+15,l_y,"::Include\\Controls\\res\\CheckBoxOn.bmp","::Include\\Controls\\res\\CheckBoxOff.bmp",true)) return false; 171 | if(!CreateLabel(mFixVolume_label,"Fix Volume",l_x_left+20,l_y,LEFT)) return false; 172 | 173 | if(!CreateLabel(mAmount_label,"Amount",l_x_right-1.75*x_size,l_y,LEFT)) return false; 174 | if(!CreateEdit(mAmount_input,1,l_x_right-x_size,l_y,(int)(x_size-CONTROLS_BUTTON_SIZE),HEIGHT)) return false; 175 | if(!CreateBmpButton(mIncreaseAmount_button,l_x_right,(int)(l_y-HEIGHT/4),"::Include\\Controls\\res\\SpinInc.bmp","::Include\\Controls\\res\\SpinInc.bmp",false)) return false; 176 | if(!CreateBmpButton(mDecreaseAmount_button,l_x_right,(int)(l_y+HEIGHT/4),"::Include\\Controls\\res\\SpinDec.bmp","::Include\\Controls\\res\\SpinDec.bmp",false)) return false; 177 | 178 | l_y+=HEIGHT+STEP; 179 | 180 | if(!CreateBmpButton(mSL_button,l_x_right-2*x_size+6,l_y,"::Include\\Controls\\res\\CheckBoxOn.bmp","::Include\\Controls\\res\\CheckBoxOff.bmp",true)) return false; 181 | if(!CreateLabel(mSL_label,"SL [pips]",l_x_right-1.9*x_size,l_y,LEFT)) return false; 182 | if(!CreateEdit(mSL_input,fmax((SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)+SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10, mSL),l_x_right-x_size,l_y,(int)(x_size-CONTROLS_BUTTON_SIZE),HEIGHT)) return false; 183 | if(!CreateBmpButton(mIncreaseSL_button,l_x_right,(int)(l_y-HEIGHT/4),"::Include\\Controls\\res\\SpinInc.bmp","::Include\\Controls\\res\\SpinInc.bmp",false)) return false; 184 | if(!CreateBmpButton(mDecreaseSL_button,l_x_right,(int)(l_y+HEIGHT/4),"::Include\\Controls\\res\\SpinDec.bmp","::Include\\Controls\\res\\SpinDec.bmp",false)) return false; 185 | mSL = StringToDouble(mSL_input.Text()); 186 | 187 | l_y+=HEIGHT+STEP; 188 | 189 | if(!CreateBmpButton(mTP_button,l_x_right-2*x_size+6,l_y,"::Include\\Controls\\res\\CheckBoxOn.bmp","::Include\\Controls\\res\\CheckBoxOff.bmp",true)) return false; 190 | if(!CreateLabel(mTP_label,"TP [pips]",l_x_right-1.9*x_size,l_y,LEFT)) return false; 191 | if(!CreateEdit(mTP_input,fmax((SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)-SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10, mTP),l_x_right-x_size,l_y,(int)(x_size-CONTROLS_BUTTON_SIZE),HEIGHT)) return false; 192 | if(!CreateBmpButton(mIncreaseTP_button,l_x_right,(int)(l_y-HEIGHT/4),"::Include\\Controls\\res\\SpinInc.bmp","::Include\\Controls\\res\\SpinInc.bmp",false)) return false; 193 | if(!CreateBmpButton(mDecreaseTP_button,l_x_right,(int)(l_y+HEIGHT/4),"::Include\\Controls\\res\\SpinDec.bmp","::Include\\Controls\\res\\SpinDec.bmp",false)) return false; 194 | mTP = StringToDouble(mTP_input.Text()); 195 | 196 | l_y+=HEIGHT+STEP; 197 | if(!CreateBmpButton(mTrailing_button,l_x_left+15,l_y,"::Include\\Controls\\res\\CheckBoxOn.bmp","::Include\\Controls\\res\\CheckBoxOff.bmp",true)) return false; 198 | if(!CreateLabel(mAllowTrailing_label,"Allow Trailing",l_x_left+20,l_y,LEFT)) return false; 199 | 200 | l_y+=HEIGHT+STEP; 201 | if(!CreateButton(mCloseAllSell_button,"Close Sell",l_x_left,l_y,x_size,HEIGHT)) return false; 202 | if(!CreateButton(mCloseAll_button,"Close All",(l_x_right-l_x_left-x_size)/2+l_x_left,l_y,x_size,HEIGHT)) return false; 203 | if(!CreateButton(mCloseAllBuy_button,"Close Buy",(l_x_right-x_size),l_y,x_size,HEIGHT)) return false; 204 | mCloseAll_button.ColorBackground(clrLightSalmon); 205 | 206 | l_y+=HEIGHT+STEP; 207 | if(!CreateLabel(mSellPositions_value,mTA.PositionsSell(),l_x_right-2.75*x_size,l_y,CENTER)) return false; 208 | if(!CreateLabel(mPositions_label,"Positoins",l_x_right-1.65*x_size,l_y,CENTER)) return false; 209 | if(!CreateLabel(mBuyPositions_value,mTA.PositionsBuy(),l_x_right-0.5*x_size,l_y,CENTER)) return false; 210 | 211 | l_y+=HEIGHT+STEP; 212 | if(!CreateLabel(mSellLots_value,mTA.LotsSell(),l_x_right-2.75*x_size,l_y,CENTER)) return false; 213 | if(!CreateLabel(mLots2_label,"Lots",l_x_right-1.65*x_size,l_y,CENTER)) return false; 214 | if(!CreateLabel(mBuyLots_value,mTA.LotsBuy(),l_x_right-0.5*x_size,l_y,CENTER)) return false; 215 | 216 | l_y+=HEIGHT+STEP; 217 | if(!CreateLabel(mSellBE_value,mTA.CalcBreakEvenSell(),l_x_right-2.75*x_size,l_y,CENTER)) return false; 218 | if(!CreateLabel(mBE_label,"BE",l_x_right-1.65*x_size,l_y,CENTER)) return false; 219 | if(!CreateLabel(mBuyBE_value,mTA.CalcBreakEvenBuy(),l_x_right-0.5*x_size,l_y,CENTER)) return false; 220 | 221 | l_y+=HEIGHT+STEP; 222 | if(!CreateLabel(mSellProfit_value,mTA.CalcProfitSell(),l_x_right-2.75*x_size,l_y,CENTER)) return false; 223 | if(!CreateLabel(mProfit_label,"Profits",l_x_right-1.65*x_size,l_y,CENTER)) return false; 224 | if(!CreateLabel(mBuyProfit_value,mTA.CalcProfitBuy(),l_x_right-0.5*x_size,l_y,CENTER)) return false; 225 | 226 | l_y+=HEIGHT+STEP; 227 | if(!CreateLabel(mEquity_label,"Equity",l_x_left+10,l_y,LEFT)) return false; 228 | if(!CreateLabel(mEquity_value,mTA.Equity(),l_x_left+x_size,l_y,CENTER)) return false; 229 | if(!CreateLabel(mMarginLevel_label,"Margin Level",l_x_left+1.65*x_size,l_y,LEFT)) return false; 230 | if(!CreateLabel(mMarginLevel_value,DoubleToString(mTA.MarginLevel(),0)+"%",l_x_left+3*x_size,l_y,CENTER)) return false; 231 | return true; 232 | } 233 | 234 | void TradingPanel::Update(void){ 235 | if(mEnable_Trailing){ 236 | mTA.TradeUpdate(); 237 | mTA.TradeClose(); 238 | } 239 | if(mTA.PositionsBuy()==0) 240 | mTA.ResetLines("BUY"); 241 | if(mTA.PositionsSell()==0) 242 | mTA.ResetLines("SELL"); 243 | 244 | mAsk_value.Text(DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),(int)SymbolInfoInteger(_Symbol,SYMBOL_DIGITS))); 245 | mSpread_value.Text(DoubleToString((SymbolInfoDouble(_Symbol,SYMBOL_ASK)-SymbolInfoDouble(_Symbol,SYMBOL_BID))/_Point,0)); 246 | mBid_value.Text(DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),(int)SymbolInfoInteger(_Symbol,SYMBOL_DIGITS))); 247 | if(mAutoLots_button.Pressed()) 248 | mLots_input.Text((mTA.CalcLots()>0)? DoubleToString(mTA.CalcLots(),2):SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN)); 249 | mSL = fmax((SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)+SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10, mSL); 250 | mSL_input.Text(DoubleToString(mSL,1)); 251 | mTP = fmax((SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)-SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10, mTP); 252 | mTP_input.Text(DoubleToString(mTP, 1)); 253 | // Update Positions Info 254 | mSellPositions_value.Text(mTA.PositionsSell()); 255 | mBuyPositions_value.Text(mTA.PositionsBuy()); 256 | mSellLots_value.Text(DoubleToString(mTA.LotsSell(),2)); 257 | mBuyLots_value.Text(DoubleToString(mTA.LotsBuy(),2)); 258 | mSellBE_value.Text(DoubleToString(mTA.CalcBreakEvenSell(),_Digits)); 259 | mBuyBE_value.Text(DoubleToString(mTA.CalcBreakEvenBuy(),_Digits)); 260 | mSellProfit_value.Text(DoubleToString(mTA.CalcProfitSell(),2)); 261 | mBuyProfit_value.Text(DoubleToString(mTA.CalcProfitBuy(),2)); 262 | // Update Account Info 263 | mEquity_value.Text(DoubleToString(mTA.Equity(),2)); 264 | mMarginLevel_value.Text(DoubleToString(mTA.MarginLevel(),0)+"%"); 265 | mLeverage_value.Text(mTA.Leverage()); 266 | ChartRedraw(); 267 | } 268 | 269 | void TradingPanel::OnTime(void){ 270 | } 271 | 272 | bool TradingPanel::CreateLabel(CLabel &object, const string text, const uint x, const uint y, ENUM_LABEL_ALIGN align){ 273 | string name = m_name+"Label"+(string)ObjectsTotal(0,-1,OBJ_LABEL); 274 | if(!object.Create(0,name,0,x,y,0,0)) return false; 275 | if(!object.Text(text)) return false; 276 | ObjectSetInteger(0,object.Name(),OBJPROP_ANCHOR,(align==LEFT ? ANCHOR_LEFT_UPPER : (align==RIGHT ? ANCHOR_RIGHT_UPPER : ANCHOR_UPPER))); 277 | if(!Add(object)) return false; 278 | return true; 279 | } 280 | 281 | bool TradingPanel::CreateEdit(CEdit &object,const string text,const uint x,const uint y,const uint x_size,const uint y_size){ 282 | string name = m_name+"Edit"+(string)ObjectsTotal(0,-1,OBJ_EDIT); 283 | if(!object.Create(0,name,0,x,y,x+x_size,y+y_size)) return false; 284 | if(!object.Text(text)) return false; 285 | if(!object.TextAlign(ALIGN_CENTER)) return false; 286 | if(!object.ReadOnly(false)) return false; 287 | if(!Add(object)) return false; 288 | return true; 289 | } 290 | 291 | bool TradingPanel::CreateBmpButton(CBmpButton &object,const uint x,const uint y,string BmpON,string BmpOFF,bool lock){ 292 | string name = m_name+"BmpButton"+(string)ObjectsTotal(0,-1,OBJ_BITMAP_LABEL); 293 | uint y1=(uint)(y-(STEP-CONTROLS_BUTTON_SIZE)/2); 294 | uint y2=y1+CONTROLS_BUTTON_SIZE; 295 | if(!object.Create(0,name,0,x-CONTROLS_BUTTON_SIZE,y1,x,y2)) return false; 296 | if(!object.BmpNames(BmpOFF,BmpON)) return false; 297 | if(!Add(object)) return false; 298 | object.Locking(lock); 299 | return true; 300 | } 301 | 302 | bool TradingPanel::CreateButton(CButton &object,const string text,const uint x,const uint y,const uint x_size,const uint y_size){ 303 | string name = m_name+"Button"+(string)ObjectsTotal(0,-1,OBJ_BUTTON); 304 | if(!object.Create(0,name,0,x,y,x+x_size,y+y_size)) return false; 305 | if(!object.Text(text)) return false; 306 | object.Locking(false); 307 | if(!object.Pressed(false)) return false; 308 | if(!Add(object)) return false; 309 | return true; 310 | } 311 | 312 | bool TradingPanel::CreateComboBox(CComboBox &object,const uint x,const uint y,const uint x_size,const uint y_size){ 313 | string name = m_name+"ComboBox"+(string)ObjectsTotal(0,-1,OBJ_BUTTON); 314 | if(!object.Create(0,name,0,x,y,x+x_size,y+y_size)) return false; 315 | if(!Add(object)) return false; 316 | if(!object.ItemAdd("NETTING")) return false; 317 | if(!object.ItemAdd("LONG/SHORT")) return false; 318 | if(!object.ItemAdd("HEDGING")) return false; 319 | return true; 320 | } 321 | 322 | // OnEvent 323 | EVENT_MAP_BEGIN(TradingPanel) 324 | ON_EVENT(ON_END_EDIT,mLots_input, Edit_Lots) 325 | ON_EVENT(ON_END_EDIT,mAmount_input, Edit_Amount) 326 | ON_EVENT(ON_END_EDIT,mSL_input, Edit_SL) 327 | ON_EVENT(ON_END_EDIT,mTP_input, Edit_TP) 328 | ON_EVENT(ON_CLICK,mAutoLots_button, Click_AutoLots) 329 | ON_EVENT(ON_CLICK,mFixVolume_button, Click_FixVolume) 330 | ON_EVENT(ON_CLICK,mSL_button, Click_SL) 331 | ON_EVENT(ON_CLICK,mTP_button, Click_TP) 332 | ON_EVENT(ON_CLICK,mIncreaseLots_button, Click_IncreaseLots) 333 | ON_EVENT(ON_CLICK,mDecreaseLots_button, Click_DecreaseLots) 334 | ON_EVENT(ON_CLICK,mIncreaseAmount_button,Click_IncreaseAmount) 335 | ON_EVENT(ON_CLICK,mDecreaseAmount_button,Click_DecreaseAmount) 336 | ON_EVENT(ON_CLICK,mIncreaseSL_button, Click_IncreaseSL) 337 | ON_EVENT(ON_CLICK,mDecreaseSL_button, Click_DecreaseSL) 338 | ON_EVENT(ON_CLICK,mIncreaseTP_button, Click_IncreaseTP) 339 | ON_EVENT(ON_CLICK,mDecreaseTP_button, Click_DecreaseTP) 340 | ON_EVENT(ON_CLICK,mTrailing_button, Click_Trailing) 341 | ON_EVENT(ON_CLICK,mOrderSell_button, Click_OrderSell) 342 | ON_EVENT(ON_CLICK,mOrderCross_button, Click_OrderCross) 343 | ON_EVENT(ON_CLICK,mOrderBuy_button, Click_OrderBuy) 344 | ON_EVENT(ON_CLICK,mCloseAllSell_button, Click_CloseAllSell) 345 | ON_EVENT(ON_CLICK,mCloseAll_button, Click_CloseAll) 346 | ON_EVENT(ON_CLICK,mCloseAllBuy_button, Click_CloseAllBuy) 347 | EVENT_MAP_END(CAppDialog) 348 | 349 | void TradingPanel::Edit_Lots(void){ 350 | mLots = StringToDouble(mLots_input.Text()); 351 | mLots_input.Text(DoubleToString(mLots,2)); 352 | ChartRedraw(); 353 | } 354 | 355 | void TradingPanel::Edit_Amount(void){ 356 | mAmount = mAmount_input.Text(); 357 | mAmount_input.Text(IntegerToString(mAmount,2)); 358 | ChartRedraw(); 359 | } 360 | 361 | void TradingPanel::Edit_SL(void){ 362 | mSL = fmax(StringToDouble(mSL_input.Text()),(SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)+SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10); 363 | mSL_input.Text(DoubleToString(mSL,1)); 364 | ChartRedraw(); 365 | } 366 | 367 | void TradingPanel::Edit_TP(void){ 368 | mTP = fmax(StringToDouble(mTP_input.Text()),(SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)-SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))/10); 369 | mTP_input.Text(DoubleToString(mTP,1)); 370 | ChartRedraw(); 371 | } 372 | 373 | void TradingPanel::Click_AutoLots(void){ 374 | if(mAutoLots_button.Pressed()) 375 | mLots_input.Text((mTA.CalcLots()>0)? DoubleToString(mTA.CalcLots(),2):SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN)); 376 | ChartRedraw(); 377 | } 378 | 379 | void TradingPanel::Click_FixVolume(void){ 380 | if(mFixVolume_button.Pressed()) 381 | mFixVolume = true; 382 | else 383 | mFixVolume = false; 384 | ChartRedraw(); 385 | } 386 | 387 | void TradingPanel::Click_SL(void){ 388 | if(mSL_button.Pressed()) 389 | mEnable_SL = true; 390 | else 391 | mEnable_SL = false; 392 | ChartRedraw(); 393 | } 394 | 395 | void TradingPanel::Click_TP(void){ 396 | if(mTP_button.Pressed()) 397 | mEnable_TP = true; 398 | else 399 | mEnable_TP = false; 400 | ChartRedraw(); 401 | } 402 | 403 | void TradingPanel::Click_IncreaseLots(void){ 404 | mLots += SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP); 405 | mLots_input.Text(DoubleToString(mLots,2)); 406 | ChartRedraw(); 407 | } 408 | 409 | void TradingPanel::Click_DecreaseLots(void){ 410 | mLots = (mLots-SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP)>0)?(mLots-SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP)):(SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN)); 411 | mLots_input.Text(DoubleToString(mLots,2)); 412 | ChartRedraw(); 413 | } 414 | 415 | void TradingPanel::Click_IncreaseAmount(void){ 416 | mAmount += 1; 417 | mAmount_input.Text(IntegerToString(mAmount,2)); 418 | ChartRedraw(); 419 | } 420 | 421 | void TradingPanel::Click_DecreaseAmount(void){ 422 | mAmount = (mAmount-1>0)?(mAmount-1):(1); 423 | mAmount_input.Text(IntegerToString(mAmount,2)); 424 | ChartRedraw(); 425 | } 426 | 427 | void TradingPanel::Click_IncreaseSL(void){ 428 | mSL += 1;//_Point; 429 | mSL_input.Text(DoubleToString(mSL,1)); 430 | ChartRedraw(); 431 | } 432 | 433 | void TradingPanel::Click_DecreaseSL(void){ 434 | mSL -= 1;//_Point; 435 | mSL_input.Text(DoubleToString(mSL,1)); 436 | ChartRedraw(); 437 | } 438 | 439 | void TradingPanel::Click_IncreaseTP(void){ 440 | mTP += 1;//_Point; 441 | mTP_input.Text(DoubleToString(mTP,1)); 442 | ChartRedraw(); 443 | } 444 | 445 | void TradingPanel::Click_DecreaseTP(void){ 446 | mTP -= 1;//_Point; 447 | mTP_input.Text(DoubleToString(mTP,1)); 448 | ChartRedraw(); 449 | } 450 | 451 | void TradingPanel::Click_Trailing(void){ 452 | if(mTrailing_button.Pressed()) 453 | mEnable_Trailing = true; 454 | else 455 | mEnable_Trailing = false; 456 | ChartRedraw(); 457 | } 458 | 459 | void TradingPanel::Click_OrderBuy(void){ 460 | mLots = StringToDouble(mLots_input.Text()); 461 | mAmount = StringToInteger(mAmount_input.Text()); 462 | if(mFixVolume) 463 | mLots = NormalizeDouble(mLots/mAmount, 2); 464 | for(uint i=0; i