Input screen

 

Hello,

I'm looking for an EA or program which includes the source code of a basic input screen. It would serve me as a code example.

I'd like to my own code to enter trades. Including my own risk management routine.

If someone has an idea where I could find a source code for an input screen, this would be great.

Thanks

 
Thanks, I'll have a look.
 

Not quite what I'm looking for.

It would be very helpfull to find a code sample which allows me to enter price information like a stop, profit taking and Stop loss.

Practically the same like the manual input screen for trades which is provided by MT4.

However I'd like to adapt the code to my needs and have it alwais present on the chart I'm trading.

Code similar to the MessageBox command.

I'm just curious how the code of such an interactive MQL4 program looks like. For me, any interactive program can sirve as an example.

Thanks.

 
redhat:

Not quite what I'm looking for.

Thanks.


doubleclick on object take the lotsize if you doubleclick it and change labelproperties then you can change lotsize

https://www.mql5.com/en/code/8950 Also working with objects to do commands

 

If you are happy to code it yourself then I'm guessing you could look to make use of ObjectDescription() (https://docs.mql4.com/objects/ObjectDescription).

In the init() of the code you create a load of labels with pre-determined names. ObjectCreate() (https://docs.mql4.com/objects/ObjectCreate). Object type = OBJ_LABEL (https://docs.mql4.com/constants/objects). You could create one for stop loss called "SL", one for take profit called "TP", etc.

Remember that labels are fixed to the X/Y co-ordinates of the window, so they move with you as you move the screen about.

You can place the labels using ObjectSet() (https://docs.mql4.com/objects/ObjectSet) for OBJPROP_XDISTANCE and OBJPROP_YDISTANCE (https://docs.mql4.com/constants/objects/properties).

You can set the font size, font type and font colour using ObjectSetText() (https://docs.mql4.com/objects/ObjectSetText).

Then you simply have a cycle in the EA which constantly checks those labels (which you already know the name of) for changes using ObjectDescription() (https://docs.mql4.com/objects/ObjectDescription) and updates the internal variables accordingly. When you want to change the values you can input them manually into the labels in the chart window (or even in a separate window).

Then in order to trade, you could have a further label which is empty by default and is always checked by the EA for the words "BUY" or "SELL" - at which point the relevant trade code is executed and the label is reset to the empty default again by ObjectSetText(). You could just then type "BUY" or "SELL" into the label box when you want to trade and let the EA do the rest.

(I say use a cycle to check the labels because otherwise the EA would only check them once per tick - so if you typed "BUY" then it would wait until the next tick before trying to place the order, which could be a while depending on your instrument and time of day. If you have it all set within a cycle using for() or while() and using Sleep() to prevent it from forming an infinite loop, then you can have it be slightly more responsive, if you require.)

You could then just create a fancy background using labels which display windings characters in large fonts (eg. 110 for a sqaure (https://docs.mql4.com/constants/wingdings) to make it look more like a typical graphical interface if you want). Obviously you would not want to accidentally delete one of the pre-named labels created by your init(), because then the EA code would not work (so there would probably need to be error handling to check for missing or duplicate labels). Any label created manually on the chart would not be checked by the EA unless it related to a specific name for the label set in the init().

(I don't think you could actually use the message boxes themselves because their inputs seem to be limited to set responses, and the EA would not necessarily know when to present you with them).

 
 

Thanks guys, I'll have a look at your suggestions.

Apreciate your help.