Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hey thanks ABCTG
when you say "the other order would get cancelled" do you mean ALL the other orders? Or do you mean just the amount of contracts --- like target1 gets hit and it is 1 contract so it only takes 1 contract off the stop? It seems like the way it is written here, it makes me think when ANY stop or target is hit, it cancels everything which is why it is reset ?
I didn't test this particular code, but from what I see the worst that could happen is that when there is a scale out of the position the remaining stop order gets cancelled and resend with the new (remaining) size.
I would always suggest to test drive the code behavior on a demo account to make sure it does what you want it to do.
I have the a similar problem where I would like to execute all trades on the same bar if possible instead of waiting for next one. Pl. see image. where last position should have hit target on prior bar. Also in this case it stops out directly. Do not know shy. Seem to be the wrong sequence trade. many thanks in advance.
I would be interested in seeing a sample code for a trailing stop with a trailing step.
The built in trailing stop function (setdollartrailing) works in a very primitive way, in that it starts trailing once peak profit is hit based on the amount of loss entered in the setdollartrailing function.
What I want is to be able to start a trailing stop from any price that I specify, and then step it by x number of pips, rather than 1 pip, which seems to be the default.
I need to know if anyone can use or program the dollar difference tool in Multichartseasylanguage.
means if we draw a trendline it gives the difference of the price...
Please help anyone is aware of it!
Hi everyone, Just joined today and love the site. My question is from a past post Mike had done regarding his post, "How to create an advanced MultiChartsEasyLanguage Strategy." I'm using TradeStation and programming a strategy. I actually copied Mike's coding and it's exactly what I'm looking for when it comes to scaling out, but have added in my own entry criteria, Unfortunately, I have a couple of problems I can't seem to figure out.
1. I have a particular signal that the trade is executed on. Kind of like a trend signal. After all my targets 3 targets are hit, the problem I'm having is, I don't want the strategy to execute another trade on the same trend signal. Once I'm filled on my third target, it will immediately execute another order and most of the time I'm stopped out giving away all the profits I just made. Does anyone know the coding to only allow it to execute one trade per signal?
2. Does anyone know the coding for a start and stop time the strategy will run? Basically just want to trade the morning E Mini S&P session, nothing after lunch.. I've tried to use the following, but not sure where to put it in the code so it functions properly.
input:
begin_time(0929),
end_time(1200);
if time > begin_time and time < end_time then
begin
{--Enter trade criteria here}
{--- EOD liquidation ---}
if time > end_time then
begin
if marketposition > 0 then sell next bar at market;
if marketposition < 0 then buytocover next bar at market;
end;
3. My final question is, what would be the coding for a maximum loss dollar wise per day and a maximum profit per day.. Once either of those are met, the system stops trading. I would need it to take into account any previous days profit or losses as well as calculate the current trade into the total.. Another words, if my max loss were $500 and I'm down $300 and the system executes another trade, it realizes I only have $200 more to go before it stop trading for the day.
If someone could help me with these final touches, I would appreciate it more than you know. I would need the coding and where to put them. Actually, if you could put them in the following code from Mike on June 2011, that would be terrific.
Mikes coding:
Big Mike Trading
June 2011
}
inputs:
smalength ( 200 ),
emalength ( 100 ),
hmalength ( 34 ),
target1 ( 12 ),
target2 ( 12 ),
target3 ( 20 ),
stopsize ( 12 ),
BE2 ( 0 ), // 0=false, 1=true
BE3 ( 0 ); // 0=false, 1=true
vars:
TickSize ( MinMove / PriceScale ),
smav ( 0 ),
emav ( 0 ),
hmav ( 0 ),
t1 ( Target1 * TickSize ),
t2 ( (Target1 + Target2) * TickSize ),
t3 ( (Target1 + Target2 + Target3) * TickSize ),
st1 ( 0 ),
st2 ( 0 ),
st3 ( 0 );
smav = Average(Close, smalength);
emav = XAverage(Close, emalength);
hmav = jtHMA(Close, hmalength);
// open new positions
if MarketPosition = 0 then begin
if smav > smav[1] and emav > emav[1] and hmav > hmav[1] then begin
Buy ("Enter long") 3 Contracts Next Bar At Market;
end;
if smav < smav[1] and emav < emav[1] and hmav < hmav[1] then begin
SellShort ("Enter short") 3 Contracts Next Bar At Market;
1. This is hard to say without the exact code. In general you can store the time or bar when your signal conditions are true in a variable. Then before you issue your entry, you use a second variable and check if the value within the second variable is different than the value in the first variable - if it is, you allow the entry and update the second variable to the value of the first variable. This would only allow entries on new signals.
2. Your entry conditions and entry orders would have to go within the section labeled "{--Enter trade criteria here}".
3. @Big Mike posted some code that can accomplish that: