log in     sign up for free
 
There are a lot of problems to solve with exits. If the worst case does not happen (i.e., so you don't get stopped out), then the job of your system is to allow you to make the most profit possible and give the least amount of it back. Only your exits do this!
Van K. Tharp
 
 
Home
systems (285)
 
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

2ways system

System for: MetaTrader

 

 

Views:  61

Added: August 25, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 
 

email this link

 
 
Tags: MetaTrader, system
 




Code:

/*[[
Name := 2 way orders
Author := Copyright c 2003, Nick Bilak beluck[AT]ukr.net
Link := http://bilak.port5.com
Notes := eur/usd m15
Lots := 1
Stop Loss := 80
Take Profit := 200
Trailing Stop := 80
]]*/
defines: Slippage(5),sf(0),risk(12),mm(0);
var: i(0),lotsi(0),dels(0),p1(0),p2(0),Stoplos(0),TrailingSto(0);

If FreeMargin<100 then Exit;
if mm<>0 then
lotsi=Ceil(Balance*risk/10000)/10
else
lotsi=Lots;
p1=stoploss/2+2;
p2=stoploss/2-3;
Stoplos=p1+p2;
TrailingSto=p1+p2;
If TotalTrades<1 then {
SetOrder(OP_BUYSTOP,lotsi,Bid+p1*Point,Slippage,Bid-p2*Point,Bid+(p1+TakeProfit)*Point,RED);
SetOrder(OP_SELLSTOP,lotsi,Bid-p2*Point,Slippage,Bid+p1*Point,Bid-(p2+TakeProfit)*Point,RED);
};
If TotalTrades=1 then {
if OrderValue(1,VAL_TYPE)=OP_SELLSTOP or OrderValue(1,VAL_TYPE)=OP_SELL then {
if ord(1,VAL_STOPLOSS)-16*Point > PriceAsk then
SetOrder(OP_BUYSTOP,lotsi,ord(1,VAL_STOPLOSS),Slippage,ord(1,VAL_STOPLOSS)-stoploss*point,ord(1,VAL_STOPLOSS)+TakeProfit*Point,RED);
};
if OrderValue(1,VAL_TYPE)=OP_BUYSTOP or OrderValue(1,VAL_TYPE)=OP_BUY then {
if ord(1,VAL_STOPLOSS)+16*Point < PriceBid then
SetOrder(OP_SELLSTOP,lotsi,ord(1,VAL_STOPLOSS),Slippage,ord(1,VAL_STOPLOSS)+stoploss*point,ord(1,VAL_STOPLOSS)-TakeProfit*Point,RED);
};
};
dels=0;
for i=1 to TotalTrades
begin
If Ord(i,VAL_TYPE)=OP_BUY then {
If (Bid-Ord(i,VAL_OPENPRICE))>(TrailingSto*Point) then {
If Ord(i,VAL_STOPLOSS)<(Bid-TrailingSto*Point) then {
ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),
Bid-TrailingSto*Point,Ord(i,VAL_TAKEPROFIT),Red);
dels=Bid-TrailingSto*Point;
}
else {
dels=0;
};
};
};
If Ord(i,VAL_TYPE)=OP_SELL then
{
If (Ord(i,VAL_OPENPRICE)-Ask)>(TrailingSto*Point) then {
If Ord(i,VAL_STOPLOSS)>(Ask+TrailingSto*Point) or
Ord(i,VAL_STOPLOSS)=0 then {
ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),
Ask+TrailingSto*Point,Ord(i,VAL_TAKEPROFIT),Red);
dels=Ask+TrailingSto*Point;
}
else {
dels=0;
};
};
};
end;
for i=1 to TotalTrades {
if (Ord(i,VAL_TYPE)=OP_SELLSTOP or Ord(i,VAL_TYPE)=OP_BUYSTOP) and dels<>0 then
DeleteOrder(ord(i,VAL_TICKET),red);
};
exit;


 




 

Code to difficult? Find somebody to help you with coding here.

 



Author: Nick Bilak

 

View similar:

Always In Play
Awesome Oscillator auto Trader
ASC Trend ++ Expert(v.2.1)
B % oscillator system
2EMA system
2EMA System-v03
2ways system
Bolliger Breakout Ver 1.0
5min USDCHF
...
 
 
all systems for MetaTrader
all systems

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
PayPalSecure payments by PayPal S4T™ is a part of TAURO EDUCATION NETWORK
 
Privacy note | (c) copyrights systems4trading.com 2006-2009