Hi All,
I think what your doing with fxDreema is fantastic!
It allows me to focus my time on the conditions of entry and exit. My custom indicators worked a treat with determining the buffers and such - great stuff.
I am trying where-ever possible to make everything use blocks, so that I can re-arrange and add other conditions or flow without having to change by hand hard-coded blocks.
I have a few common tasks I write within my EAs and wonder what is the right fxDreema way to do these things:
On the init() in my EA usually works on one timeframe and either on one particular currency pair or other currency pairs that have different global values such as stop loss, take profit, trailing stop, etc.
Question 1:
In my code today if I do the following:
if (Period() != PERIOD_M5) {
Comment("ERROR: This EA needs works on the 5 minutes interval, Please CLICK the M5 button. EA STOPPED. Please click on the M5 for this EA to work.");
StopEA = true; // this in start will just return on tick, exiting ea with message would be nice as well.
return (-1);
}
I understand that Comment is available as a block and creating a Flag called StopEA is available as a block.
I can't see a block that contains the actual major MT4 properties for the chart / timeframe. There is account and such which is great but I can't see it.
If you could add this that would be great.
if (StringSubstr(Symbol(), 0, 6) != "EURUSD"){
Comment("ERROR: Currency Chart needs to be AUDUSD chart. EA STOPPED. Remove EA from current chart and Attach EA to AUDUSD 5M Chart. Currently on chart:", StringSubstr(Symbol(), 0, 6) );
StopEA = true;
return (-1);
}
Once again I can't see Symbol, I do the string substr as a number of brokers add a suffix.
At the top of my start() block i have the StopEA flag true or false. with False just putting an error message.
I don't mind coding for some of my esoteric functions, however I thought these simple points would be out of the box.
In library studio how do I make these two functions be in a block? Is there any good examples that actually give a true /false value that I can use as a basis. I couldn't actually find any good documentation and a meaningful example for the library studio. An example where you have a function that returns values.
Another example is I want to set the buy lot size to a result of my own function. I would like to avoid custom MQL4 code and make this a block.
Say I wanted the lot size determined by dividing the account balance by 1,000
Lots = MathMax( NormalizeDouble( (((MathFloor(AccountBalance() /1000))) * 0.01) , LotsDigits) , MinLots) ;
How do I make this function as a block so I can put that in before the buy/sell block?. Your help would be much appreciated.
I don't mind make a number of my blocks I create - provided they are useful for others / and it's easy to do in Library studio - available to everyone.
I would like to make some function blocks so that other people could use them as well.
Looking at a number of my EAs I notice a few functions not available from the system library, that might be beneficial to others: (Apologies if this is already available out of the box - new to this tool)
-
after an on bar event, whenever the order history has changed and it's either a buy or sell (not a pending order cancel, manual cancel, credit or debit) then call a function adding these orders to a Loop, with this let let me send this data to a file or to a server with a list of parameters while returning the new lot size.
-
A cool feature for me would be a stats table that holds distances from different values such as distance from 100 SMA and other SMA, and distance from price. You set all these values and then when a trade is completed you output these values with the profit and can be used to determine what other values can be used to make the EA profitable.
-
I would like you to support a PSAR trailing stop and a ATR trailing stop (I can provide code for this, if that makes it easier)
-
detect a GAP, i don't want to trade on after a GAP.
-
a simple volatility check, if the average distance between the high and the low for the last n bars is >=N
-
liquidity check - too little ticks, get average number of ticks.
-
for Money management you normally have five strategies
1 = fixed lot
2 = fixed fraction
3 = fixed ratio
4 = percent risk
5 = percent volatility
-
please support lot size as fixed ratio
Fixed ratio MM uses a variable % risk to ensure a constant ratio between position size and the rate at which position sizes increase: your risk is higher when your account is small than it is when your account is large.
Some of the functions available are very powerful and I think some documentation is holding back people getting their full worth from this product. It would be nice to have an FAQ that points to features of the blocks that support different problems. For example, "If the trade is older than say 2 days then close the trade."
This can be achieved from the Category: "Actions over the group of trades"
Close each trade has the ability to close trades that have meet a user specified expiration time.