Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

XIT_BuySellAutoStoploss.mq4 - Stoploss set from Fractal Levels, Money management Risk/Reward - script for MetaTrader 4

Views:
27850
Rating:
(9)
Published:
2011.01.11 18:33
Updated:
2014.04.21 14:55
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

XIT_BuySellAutoStoploss.mq4 - Stoploss set from Fractal Levels, Money management Risk/Reward

My main goal here with this script was to help improve my win ratio, by setting my stoploss at fractals with the best support. I had been using fixed stoploss values, and kept having the stop hit and within minutes the price went back into the correct direction. This script has really helped me spot out recent support/resistance levels, providing good stop levels.

Here are some of the features of the script, and a basic run threw of how to use it.


First off you must either choose to BUY or SELL. If both are left false you will get a message stating this and have to relaunch the script. Same error will occur if both are true.


The next thing to do would be to set your Risk%, default is set at 2%.

The way that i calculate lots to risk in this script is as follows:

FreeMargin * Risk% = RiskCapital

(RiskCapital / StopLossPips) / (Leverage / ExchangeRate) = Volume

This formula should give an accurate Risk/Stoploss pip volume. On accounts with small deposits you may end up risking more than the risk percentage you were hoping for. In this case you will get a message stating that you are risking more than your Risk%. You will have the option to continue or not.

The Reward multiplier is fairly simple, basically if you want your takeprofit set to the same number of pips as the stoploss enter 1, for twice the stoploss pips 2 etc...

StopAdd, just adds x amount of pips to the fractal based stoploss level.

MaxSlip, sets the maximum price slippage allowed when opening trade.

MaxSpread, sets the maximum allowed spread.

Magic, sets the magic number for the trade. 0 if none.


The next thing to do is choose the Fractal level you wish to place your stop at. It is a good idea to have the fractal indicator on your chart so you can see a clearer picture of these levels. There will be a message asking if you want to place your stop at 0.3434 etc... if the first stop is where you want it, click no and go to the next Fractal and so on.


After clicking yes the script to run as intended and open your order. If there is an error, you should get a message stating what it is.

I hope this script can help some of you out, and please let me know if there issues with the script so that i can get them all fixed. Also if there are any additions or modifications that would make this script better please let me know..

Happy Trading


MACD Ichimoku MACD Ichimoku

The MACD Ichimoku indicator uses the Ichimoku structure but applied to MACD values. It tells an entire story in itself which is one of the Ichimoku system strengths.

MACD+Histogram MACD+Histogram

This is a normal MACD with Histogram. It's really simple coding but helpfull. I'm not testing on MT5 but i think it's ok with that. Let me know if you're tested.

ZigZag of Orlov ZigZag of Orlov

Zigzag with a simple, clear and natural principle of work. By the Close prices. Without redrawing.

CustomTimeframe Candles CustomTimeframe Candles

Shows custom Timeframes on the Main chart