Skip to content

Instantly share code, notes, and snippets.

//+------------------------------------------------------------------+
//| Acceleration.mq4 |
//| Copyright 2017, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
void closeAllOpen() {
int total = OrdersTotal();
for(int i; i < total; i++) {
OrderSelect(0, SELECT_BY_POS);
int ticketNumber = OrderTicket();
double price = OrderType() == OP_BUY ? Bid : Ask;
OrderClose(ticketNumber, OrderLots(), price, 3);
}
}
input double trailingStop
void tailStop() {
for (int i = 0; i < OrdersTotal(); i++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() == OP_BUY) {
if (Bid - OrderOpenPrice() > trailingStop * MarketInfo(NULL, MODE_POINT)) {
if (OrderStopLoss() < Bid - trailingStop * MarketInfo(NULL, MODE_POINT)
|| (OrderStopLoss() == 0)) {
@notmii
notmii / type5.c
Last active November 14, 2015 03:02
//---------declare external input
extern double RiskPercent=1;
extern double reward_ratio=2;
extern int PadAmount=0;
extern int CandlesBack=5; double pips; int Oninit()
{ // initialize 4digit or 5digit broker setup
pips = Point;
if (_DIGITS== 5 || _DIGITS == 3)
pips *=10;
return(INIT_SUCCEEDED);
https://github.com/manahl/arctic
http://sourcemaking.com/design_patterns
@notmii
notmii / install-phalcon
Last active August 29, 2015 14:11
install-phalcon
#!/bin/bash
sudo apt-get install --yes php5-dev libpcre3-dev gcc make git
sudo apt-get isntall --yes php5 php5-fpm
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
sudo echo 'extension=phalcon.so' > /etc/php5/mods-available/phalcon.ini
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/cli/conf.d/phalcon.ini
sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/fpm/conf.d/phalcon.ini
@notmii
notmii / python-project-skeleton
Last active August 29, 2015 14:01
Generate python project skeleton
mkdir sample docs tests requirements
touch README.rst LICENSE setup.py
touch sample/__init__.py sample/core.py sample/helpers.py
touch docs/index.rst docs/conf.py
touch tests/test_basic.py tests/test_advanced.py
touch requirements/production.txt requirements/development.txt requirements/staging.txt
ln -s requirements/development.txt requirements.txt
virtualenv venv
@notmii
notmii / install-python
Created May 27, 2014 16:12
Setup Python Envoronment
sudo apt-get install --yes python python-pip
sudo pip install -U pip
sudo pip install virtualenv