Help on Trading rules
13 replies
alvinleongcw
10 years ago #114992
Hi,
i need to know how i cant prevent the signal after appear once it will stop giving the same signal even though the rules is valid for at least after “x” numbers of bars away. Or how should i change my coding to such way while keep the possibility of signal as per current trading rules
Attached screenshot of the said S3-EMA.BB.MACD.STOCH rules.
thanks
0
Tomas Matejka
10 years ago #136359
Hello,
this could do the job. Set by default to 5 bars waiting for another trading signal.
0
alvinleongcw
10 years ago #136401
0
alvinleongcw
10 years ago #136402
Hello,
this could do the job. Set by default to 5 bars waiting for another trading signal.
i try to add then only notice this issue.
0
Tomas Matejka
10 years ago #136466
If you want to somehow format alert email you can use method described here https://forum.mql4.com/29800 I have never tried it though so I cannot confirm it does what you want
If I understand correctly you only want to apply the trading restriction on one trading rule only so others will be unaffected?
0
alvinleongcw
10 years ago #136492
Hi tomas, you are right only want to restrict to one of the rules of all the rules in one file.
regarding the email alert format i thought the EA wizard able to code it. anyway, is ok. just ignore it 🙂 i read the link you provided its not what i wanted. thanks
additional, i would like to know how to code an action to have for example the email alert with say the predefined SL in pips=low of previous heikin ashi candle then a profit target say PT=2*ATR or whichever formula
0
Tomas Matejka
10 years ago #136630
Hello,
So you would like to have SL placed as the low of the previous bar and PT set to 2 x ATR? I can create an example for this for you if you need it
0
alvinleongcw
10 years ago #136658
hi,
actually SL to 2xATR i can do it with the tutorial available from website. What i would like to learn is way to code for info i need to be set out in email alert format.
example is i want email alert telling me the lot size to trade based on a formula of say “high – low” then tell me the SL and also TP based on my predefined formula
0
Tomas Matejka
10 years ago #136690
create variables for SL, PT, lotSize and calculate them in Wizard appropriately using built-in functions
then setup Send Email alert and place there text like
"SL value pips: "+SL+" PT value pips: "+PT+" Trade size was: "+lotSize
This way you should receive email with SL, PT and trade size values
0
alvinleongcw
10 years ago #136734
create variables for SL, PT, lotSize and calculate them in Wizard appropriately using built-in functions
then setup Send Email alert and place there text like
"SL value pips: "+SL+" PT value pips: "+PT+" Trade size was: "+lotSizeThis way you should receive email with SL, PT and trade size values
Hi i try to formulate it and i think it should be right but somewhere it doesnt give me the signal after i put it to test.
current running candle =shift 0
previous candle =shift 1
also what kind of rules do i need to use to only send the signal for rules that is valid at close of current candle?
the things i want to do and need your help to review.
1.Stoploss to be difference in pips between previous heikin ashi candle high and low. then this values in pips to add another entrySLbuffer of mine and i try to converttorealpips for the SL use in position sizing.
2.profit target to be 1.5x(my stoploss in item 1)
3.then i want to create a “stop order” entry price for long trade 1 pip to high of previous heikin aishi candle and pending SL order to be 2 pips to low of previous heikin ashi candle price
4.then finally i want to receive email message of the SL; PT; Tradesize; entry price and sl price all based on rules above
really neeed your help to review this
0
Tomas Matejka
10 years ago #136757
Hello, ok I will look at what you posted and let you know
0
Tomas Matejka
10 years ago #136836
1) I suggest to calculate stop-loss in pips into a separated variable. Using ‘Log To Journal’ you can see whether the stop loss size is calculated correctly
2) multiply that calculated value by 1.5 and set it as PT
3) you should be able to set those price (heiken ashi) for stop order. As with 1) it’s always good to save some calculated value and output it into MT journal to see if you are doing it correctly
4) to use any variables in Email function you need to first define them, then calculated their value before they are used
let me know if you need example for any of these
0
alvinleongcw
10 years ago #136844
ya i need an example as i really no idea how to code it after i tried based on your previous suggestion. and cant get it right.
I attached my file in the reply above.
They way i do it is will always convert to signal indicator to test first before going live. I have problem of using strategy tester.
0
Tomas Matejka
10 years ago #137469
Hello,
it can be done like this. I think email alerts works only in simulated or live mode not backtest
0
Viewing 13 replies - 1 through 13 (of 13 total)