Can someone translate this tradestation strategy into an MT4 EA? - MetaQuotes MetaTrader MQL Programming | futures io social day trading
futures io futures trading


Can someone translate this tradestation strategy into an MT4 EA?
Updated: Views / Replies:1,202 / 1
Created: by warrenpuffit Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Can someone translate this tradestation strategy into an MT4 EA?

  #1 (permalink)
Trading Apprentice
orlando/florida/usa
 
Futures Experience: None
Platform: tradestation
Favorite Futures: es
 
Posts: 3 since Sep 2011
Thanks: 0 given, 1 received

Can someone translate this tradestation strategy into an MT4 EA?

futures.io (formerly BMT) users,

I recently had a friend ask me to look at his automated strategy idea. I coded it quite easily in tradestation, but he uses MT4. I kind of got in over my head... the translation didnt go very far. if someone has the time, i would love to help them out with anything tradestation related...

Its basically averaging down up to 5 times with a 7.5 pip take profit. If i get below a ceratin loss while all in 5 times, i have a "hedge" put in, flip and double down.... this is how i had Tradestation understand it

 
Code
inputs: 
	PriceH( High ),  
	PriceL( Low ), 
	PriceC( Close ), 
	StochLength( 14 ), 
	SmoothingLength1( 3 ), { used to slow FastK to FastD = SlowK }
	SmoothingLength2( 3 ), { used to slow FastD to SlowD }
	SmoothingType( 1 ), { pass in 1 for Original, 2 for Legacy }
	OverSold( 20 ), 
	OverBought( 80 ) ; 

variables:
	oFastK( 0 ), 
	oFastD( 0 ), 
	oSlowK( 0 ), 
	oSlowD( 0 ) ;

Value1 = Stochastic( PriceH, PriceL, PriceC, StochLength, SmoothingLength1, 
 SmoothingLength2, SmoothingType, oFastK, oFastD, oSlowK, oSlowD ) ;

////////////////////Data 2 P-SAR///////////////////////
variables: AfStep( 0.02, data2 ), AfLimit( 0.2 ,data2) ; 
variables: oParCl( 0 ,data2), oParOp( 0,data2 ), oPosition( 0,data2 ), oTransition( 0 ,data2) ;

 Value1 = ParabolicSAR( AfStep, AfLimit, oParCl, oParOp, oPosition, oTransition ) of data2 ; 


//////////////Triggers////////////////////////
Vars: hedgebuy1(false), hedgebuy1lotsize(0), hedgebuy2lotsize(0), hedgebuy2(false);
inputs: takethemoney(75);
Vars: hedgesell1(false), hedgesell2(false), hedgesell1lotsize(0), hedgesell2lotsize(0);
vars: onebuy(false), twobuys(false), threebuys(false), fourbuys(false), fivebuys(false), 
onesell(false), twosells(false), threesells(false), foursells(false), fivesells(false);

If (marketposition=0) and (oParCl < (low data2 )) and (oslowk crosses above 20) and (onebuy=false) then begin
buy ("Buy1") 100000 contracts this bar on close;
onebuy=true;
end;

If  (currentcontracts=100000) and (marketposition=1) and (openpositionprofit<=-200) and (onebuy=true) and (hedgebuy1=false) and (hedgebuy2=false) and 
(hedgesell1=false) and (hedgesell2=false) and (oslowk < 20) and (oParCL<(low data2)) Then begin
buy ("Buy2") 100000 contracts this bar on close;
twobuys=true;
end;

If  (currentcontracts=200000) and (marketposition=1) and (openpositionprofit<=-600) and (hedgebuy1=false) and (hedgebuy2=false) and (hedgesell1=false) 
and (hedgesell2=false) and (oParCl< (Low data2)) and (threebuys=false) and (oslowk < 20) Then begin
buy ("Buy3") 100000 contracts this bar on close;
threebuys=true;
end; 

If (currentcontracts=300000) and (marketposition=1) and (oParCl<(Low data2)) and (openpositionprofit<=-1200) and (hedgebuy1=false) and (hedgebuy2=false) and (hedgesell1=false)
and (hedgesell2=false) and (fourbuys=false) and (oslowk < 20) Then begin
buy ("Buy4") 100000 contracts this bar on close;
fourbuys=true;
end;

If (currentcontracts=400000) and (marketposition=1) and (oParCl< (Low data2)) and (openpositionprofit<=-2000) and (hedgebuy1=false) and (hedgebuy2=false) and (hedgesell1=false) 
and (hedgesell2=false) and (fivebuys=false) and (oslowk < 20) Then begin
buy ("Buy5") 100000 contracts this bar on close;
fivebuys=true;
end;


//hedging losing buy1
vars: hedgebuy1loss(0);

If ( (fivebuys=true) and (oParCl>(high data2)) ) then begin
hedgebuy1= true;
hedgebuy1loss= getpositionopenpl(getsymbolname, getaccountid);
Sell ("close5buys") 500000 contracts this bar on close;
sellshort ("Hedge losing buy") 1000000 contracts this bar on close;
onebuy=false;
twobuys=false;
threebuys=false;
fourbuys=false;
fivebuys=false;
end;

//closing from hedging losing buy1
If ( (hedgebuy1=true) and (hedgebuy2=false) ) then begin
If (getpositionopenpl(getsymbolname,getaccountid)> (-1*hedgebuy1loss+75)) then buytocover ("close hedgebuy1") 10000000 contracts this bar on close;
hedgebuy1=false;
end;

//hedging losing buy2
vars: hedgebuy2loss(0);
If ( (hedgebuy1=true) and (oParCl<(low data2)) ) then begin
hedgebuy2=true;
hedgebuy2loss= getpositionopenpl(getsymbolname, getaccountid);
Buytocover ("closebuyhedge1") 1000000 contracts this bar on close;
Buy ("Hedge losing buy 2") 2000000 contracts this bar on close;
hedgebuy1=false;
end;

//closing from hedging losing buy2
If (hedgebuy2=true) then begin
If (getpositionopenpl(getsymbolname,getaccountid)> (-1*hedgebuy2loss+75)) then sell ("close hedgebuy2") 20000000 contracts this bar on close;
end;
}
///////////////Triggers///////////
If (marketposition=0) and (onesell=false) and (oParCl > (high data2)) and (oslowk crosses below 80) then begin
sellshort ("SellS1") 100000 contracts this bar on close;
onesell=true;
end;

If (currentcontracts=100000) and (marketposition=-1) and (openpositionprofit<=-200) and (hedgebuy1=false) and (hedgebuy2=false)
 and (hedgesell1=false) and (hedgesell2=false) and (oParCl>(high data2)) and (twosells=false) and (oslowk > 80) Then begin
 sellshort ("sellS2") 100000 contracts this bar on close;
twosells=true;
end;

If (currentcontracts=200000) and  (marketposition=-1) and (openpositionprofit<=-600) and (hedgebuy1=false) and (hedgebuy2=false)
 and (hedgesell1=false) and (hedgesell2=false) and (oParCl>(high data2)) and (threesells=false) and (oslowk > 80) Then begin
 sellshort ("sellS3") 100000 contracts this bar on close;
threesells=true;
end;

If (currentcontracts=300000) and (marketposition=-1) and (openpositionprofit<=-1200) and (hedgebuy1=false) and (hedgebuy2=false)
 and (hedgesell1=false) and (hedgesell2=false) and (foursells=false) and (oParCL>(high data2)) and (oslowk > 80) Then begin
 sellshort ("sellS4") 100000 contracts this bar on close;
foursells=true;
end;

If (currentcontracts=400000) and (marketposition=-1) and (openpositionprofit<=-2000) and (hedgebuy1=false) and (hedgebuy2=false) 
and (hedgesell1=false) and (hedgesell2=false) and (fivesells=false) and (oParCL > (high data2)) and (oslowk > 80) Then begin
sellshort ("sellS5") 100000 contracts this bar on close;
fivesells=true;
end;

//hedging losing sell 1
vars: hedgesell1loss(0), hedgesell2loss(0);

If ( (oParCl<(low data2)) and (fivesells=True) ) then begin
hedgesell1= true;
onesell=false;
twosells=false;
threesells=false;
foursells=false;
fivesells=false;
hedgesell1loss= getpositionopenpl(getsymbolname, getaccountid);
buytocover("closeshorts") 500000 contracts this bar on close;
buy ("Hedge losing short") 1000000 contracts this bar on close;
end;

//closing from hedging losing buy1
If ( (hedgesell1=true) and (hedgesell2=false) ) then begin
If (getpositionopenpl(getsymbolname,getaccountid)> (-1*hedgebuy1loss+75)) then sell ("close hedgesell1") 10000000 contracts this bar on close;
hedgebuy1=false;
end;

//hedge losing sell 2 

If ( (hedgesell1=true) and (oParCl>(high data2))) then begin
hedgesell2=true;
hedgesell1=false;
hedgesell2loss= getpositionopenpl(getsymbolname, getaccountid);
Sell ("closesellhedge1") 1000000 contracts this bar on close;
Sellshort ("Hedge sell 2") 2000000 contracts this bar on close;
end;


//closing from hedging losing sell2
If (hedgesell2=true) then begin
If (getpositionopenpl(getsymbolname,getaccountid)> (-1*hedgesell2loss+75)) then buytocover ("close hedgesell2") 20000000 contracts this bar on close;
end;

///Take profit and reset strategies on non hedged trades

vars: openbuys(0), opensells(0);
vars: skipp(0), positions(0);
openbuys=0;
opensells=0;

positions= Getpositionopenpl(getsymbolname, getaccountid);

If ((positions> 75) and (hedgebuy1=false) and (hedgebuy2=false) and (hedgesell1=false) and (hedgesell2=false) ) then begin

skipp=0;

If (onebuy=True) and (skipp=0) then openbuys=openbuys+100000;
If (twobuys=True) and (skipp=0) then openbuys= openbuys+100000;
If (threebuys=True) and (skipp=0)  then openbuys= openbuys+100000;
If (fourbuys=True) and (skipp=0)  then openbuys= openbuys+100000;
If (fivebuys=True) and (skipp=0)  then openbuys= openbuys+100000;
If (onesell=True) and (skipp=0)  then opensells=opensells+100000;
If (twosells=True) and (skipp=0)  then opensells= opensells+100000;
If (threesells=True) and (skipp=0)  then opensells= opensells+100000;
If (foursells=True) and (skipp=0)  then opensells= opensells+100000;
If (fivesells=True) and (skipp=0)  then opensells= opensells+100000;
buytocover ("flatten sells") opensells contracts next bar on open;
sell ("flatten buys") openbuys contracts next bar on open;
onebuy=false;
twobuys=false;
threebuys=false;
fourbuys=false;
fivebuys=false;
onesell=false;
twosells=false;
threesells=false;
foursells=false;
fivesells=false;
hedgesell1=false;
hedgesell2=false;
hedgebuy1=false;
hedgebuy2=false;
end;

if this seems like a lot, but its possible, please email me mike @ schauben .com and we can talk about this being a compensated project.

-warrenpuffit

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Reply



futures io > > > > > Can someone translate this tradestation strategy into an MT4 EA?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Translate Tradestation indicator to Ninja trader esam_jir NinjaTrader Programming 8 February 15th, 2014 01:38 AM
Modify Supertrend strategy in mt4 indiantrader MetaQuotes MetaTrader MQL Programming 7 April 7th, 2012 01:36 PM
Supertrend trading strategy / TradeStation mengelbrecht Elite EasyLanguage Automated Trading 12 February 13th, 2012 01:39 PM
Hedging Auto Strategy with Tradestation? warrenpuffit EasyLanguage Programming 2 December 11th, 2011 09:18 AM
MT4 ordering appl. , range chart for MT4 ,Is there such an animal ? Manfred MetaTrader 3 May 22nd, 2011 11:29 AM


All times are GMT -4. The time now is 05:26 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-16 in 0.08 seconds with 19 queries on phoenix via your IP 54.160.245.121