MT-4 free source code

This is a discussion on MT-4 free source code within the Free Systems forums, part of the Mechanical & Systems Trading category; if anybody wants an alert-type thing using RSI or Stochastics, here is something I did, and have been using on ...

Reply
5 5 Attachment(s)
 
LinkBack Thread Tools
Legendary Member
 
trendie's Avatar
 
Join Date: Jan 2004
Posts: 4,568
trendie's Trading Profile
MT-4 free source code

if anybody wants an alert-type thing using RSI or Stochastics, here is something I did, and have been using on MT-4.

NB: Bar-0 is current bar. Bar-1 is last bar, Bar-2 is bar before that. (ie, it counts backwards)

It looks for OverSold and OverBought conditions on RSI and Stochastics.
(if you dont one of them you "comment them out" by putting "//" in front of the line.)

what it does is see if the indicator has "hooked" beyond the user-defined values.
eg; on RSI, if Upper value is 80, it will give you an alert if the last closed bar (Bar-1) is lower than the bar before AND the bar-before (Bar-2) was above 80. This means the price has hooked down after rising above the threshold value of 80.
similar for Lower values, except the indicator value has to hook upwards after being below the threshold.

this concept is also applied to Stochastics.

the Alert shows:
the currency pair being alerted. eg, GBPUSD
the time-frame on which it triggered, eg, 5 (means on 5-min chart)
a short-code for the event. eg, RSI-OB, RSI-OS, STX-OB, STX-OS.
the date/time it happened, chart-time. NB: this can be different from PC-time, due to brokers, etc.
the CLOSE price of last closed bar. eg, 2.0244
the indicator values changing. eg, 18.50 >> 21.5. (this means the indicator hooked from 18.5 on Bar-2, and was 21.5 on last bar, showing indicator is hooking up)

the alert is by no means perfect, but has removed the psychological element of trying to dither over best-price of when to place a trade, and also takes me away from the screen, reducing over-analysis, and just letting the trade get on with it.

also, the alert acts as a reminder to come and check progress.
ultimately, it is only an aid, and the trader must press the buy and sell buttons themselves.

EDIT: first screen-shot shows the user-interface entering the triggering parameters, eg, RSI value, and the Upper and Lower levels that trigger an alert. similarly for Stochastics lower down in same frame.
second screen-shot shows what the alerts display on the screen. (these can also be sent via SMS to a mobile.)
The attached file, x_RSI_Stochs.txt needs to be saved to the indicators directory, and saved as x_RSI_Stochs.mq4.
Attached Thumbnails
xrsi_001.gif   xrsi_002.gif  
Attached Files
File Type: txt x_RSI_Stochs.txt (4.6 KB, 201 views)
__________________
If the only tool you have is a hammer, you tend to see every problem as a nail - Abraham Maslow
There are 10 kinds of people in the world; those that understand binary, and those that dont. -Anon
Warning: May contain nuts.

Last edited by trendie; Dec 14, 2007 at 10:49am.
trendie is online now   Reply With Quote
Legendary Member
 
trendie's Avatar
 
Join Date: Jan 2004
Posts: 4,568
trendie's Trading Profile
trendie started this thread Pin-Bar noddy indicator.
shows bars where body size (Open-to-Close) is 25% or less of bar-size (High-to-Low).

if the open/close of the small body falls within the top 25% it is flagged as bullish. (blue diamond)
if the open/close of the small body falls within the bottom 25% it is flagged as bearish. (red diamond)
if the open/close of the small body falls within the middle 50% it is flagged as spinning-top.
(white diamond. Yeah, I know, useles if blackground is white!)

for some reason the flags reduce in size if recompiled onto the chart. so, best to close the chart and reload.

NB: the PinBar.txt needs to be renamed as PinBar.mq4 and compiled.

Did it just for fun!

EDIT: added a sample GBPUSD screen.

EDIT2: the indicator does not guarantee that you will make money, and is for educational purposes only. Please seek independant financial advice before blowing money on pretty patterns.
Attached Thumbnails
pinbarsample.gif  
Attached Files
File Type: txt PinBar.txt (8.6 KB, 370 views)
__________________
If the only tool you have is a hammer, you tend to see every problem as a nail - Abraham Maslow
There are 10 kinds of people in the world; those that understand binary, and those that dont. -Anon
Warning: May contain nuts.

Last edited by trendie; Jan 1, 2008 at 9:59am.
trendie is online now   Reply With Quote
Guest
 
Join Date: Dec 2002
Posts: 5,714
JTrader's Trading Profile
Arrow

Quote:
Originally Posted by trendie View Post
if anybody wants an alert-type thing using RSI or Stochastics, here is something I did, and have been using on MT-4.

NB: Bar-0 is current bar. Bar-1 is last bar, Bar-2 is bar before that. (ie, it counts backwards)

It looks for OverSold and OverBought conditions on RSI and Stochastics.
(if you dont one of them you "comment them out" by putting "//" in front of the line.)

what it does is see if the indicator has "hooked" beyond the user-defined values.
eg; on RSI, if Upper value is 80, it will give you an alert if the last closed bar (Bar-1) is lower than the bar before AND the bar-before (Bar-2) was above 80. This means the price has hooked down after rising above the threshold value of 80.
similar for Lower values, except the indicator value has to hook upwards after being below the threshold.

this concept is also applied to Stochastics.

the Alert shows:
the currency pair being alerted. eg, GBPUSD
the time-frame on which it triggered, eg, 5 (means on 5-min chart)
a short-code for the event. eg, RSI-OB, RSI-OS, STX-OB, STX-OS.
the date/time it happened, chart-time. NB: this can be different from PC-time, due to brokers, etc.
the CLOSE price of last closed bar. eg, 2.0244
the indicator values changing. eg, 18.50 >> 21.5. (this means the indicator hooked from 18.5 on Bar-2, and was 21.5 on last bar, showing indicator is hooking up)

the alert is by no means perfect, but has removed the psychological element of trying to dither over best-price of when to place a trade, and also takes me away from the screen, reducing over-analysis, and just letting the trade get on with it.

also, the alert acts as a reminder to come and check progress.
ultimately, it is only an aid, and the trader must press the buy and sell buttons themselves.

EDIT: first screen-shot shows the user-interface entering the triggering parameters, eg, RSI value, and the Upper and Lower levels that trigger an alert. similarly for Stochastics lower down in same frame.
second screen-shot shows what the alerts display on the screen. (these can also be sent via SMS to a mobile.)
The attached file, x_RSI_Stochs.txt needs to be saved to the indicators directory, and saved as x_RSI_Stochs.mq4.
Thanks Trendie.

Does this RSI/STOCH indicator draw the red & blue circles on the charts, as shown in your screenshot? or did you add the red/blue circles manually?

Should the MQL code work properly from the .txt file without any further modifications when added to an indicator?

I saved the code from the .txt file to an indicator, but am not getting the stochastic on the sub chart, and am not getting the red & blue circles .


If possible, It would be easier for all concerned I think, if you add the actual indicator to a .zip file, and upload the .zip file, rather than saving/uploading as a .txt file. That way user error does not/cannot be an issue (while transferring the MQL code from the .txt file to the MT4 indicator).

Thanks a lot.



EDIT: The sooner T2W allows the uploading of metatrader4 files - the better .

Last edited by JTrader; Jan 1, 2008 at 1:05pm.
JTrader is offline   Reply With Quote
Legendary Member
 
trendie's Avatar
 
Join Date: Jan 2004
Posts: 4,568
trendie's Trading Profile
trendie started this thread hi JT,

the indicator doesnt show the red and blue circles! those are "demark trend" circles.
(I use them to show me recent swing-highs and swing-lows, and if they congregate at certain prices, they show me potential sup/res points).

they are nothing to do with the RSI indicator I added.
the screen-shot really was meant to illustrate the format of the alerts, not my chart set-up!

all it does is take the ordinary RSI indicator and add alerts when the values hook for RSI.
I then piggy-back the Stochastics alerts only. It doesnt show the stochastics at all - just the alert.

the alert is a short-hand for things I look for. Ideally I should have an alert for the RSI and Stochs separately, but that doesnt interest me.

the .txt needs only to be renamed .mq4 and compiled once there.
__________________
If the only tool you have is a hammer, you tend to see every problem as a nail - Abraham Maslow
There are 10 kinds of people in the world; those that understand binary, and those that dont. -Anon
Warning: May contain nuts.
trendie is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
could it be....a trading platform source code for 5k...AWESOME. yari123 Mechanical & Systems Trading 3 Oct 25, 2007 2:14am
Looking for free, real time AD line source herringtrader Indices 0 May 31, 2006 3:24am


New To Site? Need Help?


All times are GMT -4. The time now is 6:27pm.


Copyright © 2001-2009 Trade2Win Ltd