Reply

Off EA when it takes profit

22 replies

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #113744

Hi, is it possible to turn off an EA once it takes profit or stoploss?

0

tomas262

Administrator, sq-ultimate, 674 replies.

Visit profile

6 years ago #130632

Hi,

 

yes, there is more than one way how to accomplish it. You can just create a variable AllowTradng set to 1 and then edit your entry long by adding condition – if AllowTrading = 1 then you enter long and in the action use “Assign Variable” and set AllowTrading = 0. This will prevent from taking more trades.

 

Then create next rule where you compare date of current bar VS date of previous bar and if they differs (new day begins) you set AllowTrading = 1 so strategy is ready for next trading day (session).

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #130645

Many thanks Tomas

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

6 years ago #130757

Tomas,

  I do not understand, i have tried multiple ways and cannot get it to work. Could you elaborate more in detail if say i wanted that particular EA to stop when it hits $20 in profit?

 

I have tried using your example, Sum of Closed Profit (in money), etccc.. and cannot get it. Need your help, its greatly appreciated. 

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

6 years ago #130763

There could be many ways, but here is one:

You create a variable. Let us call it DailyProfitMet.

You make a new ruke:
If daily sum profit >20 dollars
Then DailyProfitMet = 1

Next, add to all your entry rules:
DailyProfitMet = 0

This makes it require DailyProfitMet to be equal to 0 before it enters a trade. And since it changes this variable to a 1 when your profit target is met, then it will not enter any new trades once your profit target is met.

Next Question is when do you want to start trading again? Let us say at the beginning of the next day. So creative another rule. This one says

If Day of Week[0] Day of Week[1]
Then DailyProfitMet = 1

Fine tune the above to fit the particulars of what you want, but this gives you a framework to use.

-stearno

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

6 years ago #130766

Stearno,

  Appreciate you response back. Normally on my EA’s i will Run a StartTime1 & EndTime1, and a StartTime2 & EndTime2. I do both trading times depending on which paid i use. Would i be able to set it to profit take between start time 1 and end time 1? and have it reset and trade again between start time 2 and end time 2,, or can i only do daily?

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

6 years ago #130767

Stearno,

  Sorry to write you again, but im still confused. I did just what you said but its now working.. Also they do not let you choose Day of Week twice. I attached the strategy i created per your directions but its not working. Hopefully you can answer back this morning as i have been wasting tons of time to figure this out

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

6 years ago #130814

Any answers as i am still struggling with this and its either not trading at all, or trading only 1 trade or just trading out of control.. 

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

5 years ago #134809

Stearno or Marc,

  Hope everything has been well with you guys. Got a quick question about the last comment above left by Stearno (thread #5)

 

I figured out how to get an EA set to stop trading once it reached a particular profit that I designated for day..

 

But Question is:

 

I trade say on an average 3 or 4 separate EA’s for an individual account. So what rule can I put in each EA where it shuts all trades down for the day once say $100 in total profits is met in total for the account? I am not worried about each EA shutting off, I just want all trading to suspend until next trading day if the $100 in total portfolio profit is met (obviously it still takes into account if first trade lost -$50, now between all EA’s running they now need to make up $150 in profit because it took into account the -$50 loss)

 

The way I have my rules set up already and per the Thread #5 above is they want it per magic number on each EA and it has me confused because I’m just worried about total profit reached as  a whole for the portfolio and not the individual EA..

 

Could you please advise how you would set these rules up?

 

Also I have attached the file as far as I can get it but what really starts confusing me is for example I may trade the strategy attached with only AUD/USD pair only..

I may have a few other EA’s trading as well on other pairs but I just want the total portfolio to stop and a certain profit level. I just don’t know how to tell the multiple EA’s to look for the same profit level.

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

5 years ago #134810

Couple of ways. I am not saying that my suggestion is the best or the only way.

One I did was have all your EA’s have a rule that assigns the account balance to a variable at the beginning of the trading day/session. Second, have a variable where you type in your daily limit (you said for you it was $100).

Then have another rule. On the left side add the first variable (days starting balance) to your daily limit (100). In the middle use greater than. Then on the right use current balance. In the

Then section of the condition, have it close all trades (if you want to close everything that is currently open. If not, then don’t put this statement.). Second Then condition, have it assign to a bool variable True.

Need to put a Conditiin on every entry rule that if this bool variable is true, then don’t enter the trade.

Lastly, add to the rule that assigns the daily balance to a variable, also put in the Then statement to assign to the bool variable False. That way it flips the switch and allows trading again on your entry rules.

So example. Your account balance at the beginning of the day is 1,500. Add your daily limit of 100 to that to be 1,600. Then your rule will compare the current balance to the 1,600. Whenever it is greater then, it will change the bool variable to true. Next the entry conditions are met but it checks this bool variable is true, so it will not enter the trade. At the beginning of the next day, it will switch the bool variable back to false and assign the account balance. So now the entry rules will trigger trades.

You can do this on all of your 3-4 EA’s.

I am not at a computer but if you need an example let me know and I can do it later for you.

-Stearno

Sent from my HUAWEI MT7-TL10 using Tapatalk

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

5 years ago #134829

Stearno,

   Appreciate the quick reply. If it wouldn’t be to much of a problem an example from you would be perfect. I just threw a quick example of a rule above, if you could modify that to what I am looking for that would be great. I get a little lost once it gets too much into the detail but as I talk and read the forum’s I get better and get a clearer understanding of all the checks and balances of the rules.

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

5 years ago #134878

Here is the way I would do this.  There is a couple of other ways you can do it, but this is my preference.  Add these rules to every EA you have running.

 

I added on there that it will close any open trades once the daily profit target is reached.  

 

If that is not there, then it will stop trades while one trade is open and then that could be a loosing trade.  Then, you would actually be below your daily profit target but the EA would be shut off.  

 

 

0

ryanbrignac9764

Subscriber, bbp_participant, community, 89 replies.

Visit profile

5 years ago #134934

Stearno,

  I took the EA you had and just tried to run it to in order to study the rules but when I load and run it, it takes no trades? The journal keeps saying “No orders found” AND ” closing all orders”.. Would you happen to know why the EA is not taking any trades? I tried to look it over but can’t seem to find the problem

 

2/11/16 @ 9pm

If at all possible could you please check on what might be wrong with this EA before you take off for the weekend, it would be much appreciated. Thanks Ryan B.

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

5 years ago #135022

I wrote it not thinking it would be used to take trades. Just as an example of the rules. I will try to look at it next couple of days.

Sent from my HUAWEI MT7-TL10 using Tapatalk

0

stearno

Customer, bbp_participant, community, 382 replies.

Visit profile

5 years ago #135039

There.  It makes trades now.  

 

We needed a starting balance.  When the EA first loads, the variable DailyAccountBalance had 0.  I put in the start menu a value of 10,000 dollars, and now the EA works.  

 

Second, when doing two different EA comparisons, it is best to use “Crosses Above” and Crosses below” instead of > and <.  

 

Remember that these rules should be added to every EA you run and the rules only control that one EA.  It is not written to be a manager of a porftolio of EAs

 

Best of luck!

 

-Stearno

0

Viewing 15 posts - 1 through 15 (of 23 total)

1 2