[Beta] Break-even Button_v1.0.0
You know what I noticed? There are no examples on how to create custom buttons or custom columns. Well, I decided to do one for buttons. You should be able to figure out how to create columns based on this example.
So, it is not supported at this time for programmers to create parameters that can later be modified without messing with the code like it is for indicators and trading systems. The default breakeven offset is 2 pips. Why? Because for some brokers, they charge commissions. So I set it to 2 pips so that it will cover your commission costs and at least give you something from the trade. All you have to do is modify that value to your preference.
Also, if the current trade is in profit by more than the offset pips, an SL will be placed instead. Why did I do this? If you're up 20 pips in a trade and you have TP set to 40 pips, when you press the breakeven button, the SL will be set to breakeven +/- offset pips. This will allow this button to work with that strategy.
If you're not in profit by the offset pip amount, then the breakeven price +/- offset pips will be a TP order. I hope this makes sense. Do this on demo until you understand and until I decide that this should no longer be in beta testing mode. Please let me know if you find any bugs.
A member was already nice enough to do an example with XML parsing, so I didn't feel the need to continue on with the news indicator that I had planned to do. Thanks Burhay Vlad for sharing your knowledge.Also, no worry, there will be a breakeven button for the chart trader that is in development. I'm working on multiple projects at once and trading forex too. I just wanted to have one for the positions panel too. Maybe later on, PFSoft could give the programmer the ability to add that custom button near the rest of the buttons on the panel. This will allow programmers to create parameters that can later be modified without going into the code.
As with all my codes, PFSOFT and I are not responsible for any negative thing that may arise from the usage of this plugin. I'm not affiliated with PFSOFT, and I'm only a third-party developer.
As always, happy trading.
Note: Position manipulations are tested in Protrader demo account and work in a proper way. It is highly recommend further to test any automated trade action per each broker and on demo only.
Burhay Vlad 19.07.2016
Well done Chris. It is indeed good approach with custom buttons and columns coding! Appreciate your contribution as always. I have just checked API and highlighted one property
which would reduce your instrument precision part in "Breakeven" code in a twice:
Instrument inst = pos.Instrument;
int precision = inst.Precision;
if (pos.CurrentPrice > (pos.OpenPrice + breakeven / Math.Pow(10,
...and so on. Keep it up Chris!