The 1st section (under settings) it is where the action code goes, I called it on tick for this but
it depends on where the block is used.
Posts made by jstap
-
RE: MT5 Close All Fastposted in Questions & Answers
-
RE: How to close all trades when running equity is grater than starting equity by $1posted in Questions & Answers
Add a comment block, in the block right click and add the variable, under add the variable again adjusted by +1
On screen you will see the difference -
RE: گروه ساخت ربات و رفع اشکال زارعposted in Questions & Answers
It shouldn't, do your trees start with a no trade block?
-
RE: Button that makes SL move closer to priceposted in Questions & Answers
@BrianaM1
It could move into a slight win, but on average a loss is more likely -
RE: Button that makes SL move closer to priceposted in Questions & Answers
Yes because at breakeven price the close signal is sent, but by the time things close price may have moved into a slight loss
-
RE: How to close all trades when running equity is grater than starting equity by $1posted in Questions & Answers
Put the result into a comment, this way you can see on screen when things should close
-
RE: Button that makes SL move closer to priceposted in Questions & Answers
If you set it to 0 it would try to close at breakeven, will likely cause a small loss though
-
RE: Button that makes SL move closer to priceposted in Questions & Answers
It is your choice, doing it that way should account for the total profit, but you have a chance that things like slippage will cause a loss
-
RE: Button that makes SL move closer to priceposted in Questions & Answers
various ways, condition block, profit < x.xx - close block
This will check the combined total profit and close all
-
RE: Button that makes SL move closer to priceposted in Questions & Answers
Set a SL, or set a close trades when loss is too much
-
RE: MT5 Close All Fastposted in Questions & Answers
I do not know, the link I put above compiles for me.
You are using on MT5?
Here is the code again
on tick section:
{
startTime = GetMicrosecondCount(); // Record start time
sTrade.SetAsyncMode(true); // Enable asynchronous trade operationsCloseAllPositions(); // Call function to close all positions PrintPerformance(startTime); // Monitor performance}
In the global variables section::
#include <Trade/Trade.mqh>
ulong startTime; // To store the start time for performance measurement
CTrade sTrade; // Trade object used for operationsIn the custom function section::
void CloseAllPositions() {
for (int cnt = PositionsTotal() - 1; cnt >= 0 && !IsStopped(); cnt--) {
if (PositionGetTicket(cnt)) {
sTrade.PositionClose(PositionGetInteger(POSITION_TICKET), 100);
uint code = sTrade.ResultRetcode();
Print("Close result code: ", IntegerToString(code));
}
}
}void PrintPerformance(ulong startTime) {
for (int i = 0; i < 100; i++) {
Print("Elapsed time: ", IntegerToString(GetMicrosecondCount() - startTime), " microseconds. Open positions: ", IntegerToString(PositionsTotal()));
if (PositionsTotal() <= 0) { break; }
Sleep(100);
}
} -
RE: THE QUESTION IS HOW TO MAKE THE VARIABLE : ‘delta_take_profit_money’ IN THIS EA TO BE AS “CONSTANT” SO THAT I CAN OPTIMIZE????posted in Questions & Answers
@sktsec I do not know, but it sells constantly. Maybe it is dependant on the part of the world. Amazon are active in these countries: United States, Canada, Mexico, United Kingdom, Germany, France, Italy, Spain, Japan, Australia, and Singapore (probably more)
I will have a look at how it could be bought otherwise, if people tell me there country they are trying to buy from I will see what I can do
-
RE: Placement of buttons and logosposted in Questions & Answers
I think this would show on the common tab, but possibly would need created by another means.
-
RE: How to close all trades when running equity is grater than starting equity by $1posted in Questions & Answers
Connect the blocks, the condition is how you had it set

-
RE: Placement of buttons and logosposted in Questions & Answers
There are a few things you need to do, creating the buttons is simple, on init draw button (named), with at least 2 blocks - on tick use then redraw
on init create the picture, in the forum you will find ways people have done this
-
RE: MT5 Close All Fastposted in Questions & Answers
To get this working in FX you need to create a custom block:
I have done that here: https://fxdreema.com/shared/GVIxc5AZ. But I haven't tested it, so I don't know if it works. You will need to set the condition to activate it
This is how I created:
in the 1st section (on tick in this case)
{
startTime = GetMicrosecondCount(); // Record start time
sTrade.SetAsyncMode(true); // Enable asynchronous trade operationsCloseAllPositions(); // Call function to close all positions PrintPerformance(startTime); // Monitor performance}
In the global variables section:
#include <Trade/Trade.mqh>
ulong startTime; // To store the start time for performance measurement
CTrade sTrade; // Trade object used for operationsIn the custom function section:
void CloseAllPositions() {
for (int cnt = PositionsTotal() - 1; cnt >= 0 && !IsStopped(); cnt--) {
if (PositionGetTicket(cnt)) {
sTrade.PositionClose(PositionGetInteger(POSITION_TICKET), 100);
uint code = sTrade.ResultRetcode();
Print("Close result code: ", IntegerToString(code));
}
}
}void PrintPerformance(ulong startTime) {
for (int i = 0; i < 100; i++) {
Print("Elapsed time: ", IntegerToString(GetMicrosecondCount() - startTime), " microseconds. Open positions: ", IntegerToString(PositionsTotal()));
if (PositionsTotal() <= 0) { break; }
Sleep(100);
}
} -
RE: How to close all trades when running equity is grater than starting equity by $1posted in Questions & Answers
To save the EA starting equity add a pass block:

To close trades if equity is higher split the trees:

-
RE: How to close all trades when running equity is grater than starting equity by $1posted in Questions & Answers
What is saving the starting equity? Blocks under a no trade block will not work once a trade is running