Welcome to NexusFi: the best trading community on the planet, with over 150,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 -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have used the following signal in real-time sim mode, connected to my broker (Interactive Brokers).
Instrument is EUR.USD.
Timeframe is 1 minute.
The "condition" becomes true a few minutes after the activation of the strategy.
But the entry is impossible (the required entry price is set @ 1000 ticks above current price).
MultiCharts has generated the buy order. This order could not be executed since the required price was too high. After one minute, the order has been automatically cancelled by MultiCharts. Evidence in MC's "Order Position Tracking window" with the "Cancelled" status:
Same behaviour (order then cancellation of the order) has been noticed in the broker's software, not shown here.
1. if condition is met then pending orders stay there forever until executed or new condition is there.
I would do something similar to the following, not tested.
Variables:
Setup ( false );
If L > L[1] AND H < H[1] {inside bar; substitute by what you want} then begin
Setup = true;
end;
If Setup AND MarketPosition = 0 then begin
Buy next bar at market;
end;
// if order executed, then set the condition at false:
If Setup AND MarketPosition = 1 then begin
Setup = false;
end;
// if "other condition", then set the condition at false:
If Setup AND L < L[1] AND H > H[1] {outside bar; substitute by what you want} then begin
Setup = false;
end;
// inspired by http://www.breakoutfutures.com/Newsletters/Newsletter0103.htm
guppy
2.if condtion is met then pending orders stay valid for 1 hour only then cancels.
I would do something similar to the following, not tested.
Variables:
Setup ( false ),
SetupBarNumber ( 0 );
If L > L[1] AND H < H[1] {inside bar; substitute by what you want} then begin
Setup = true;
SetupBarNumber = BarNumber;
end;
If Setup AND MarketPosition = 0 then begin
Buy next bar at market;
end;
// if order executed, then set the condition at false:
If Setup AND MarketPosition = 1 then begin
Setup = false;
end;
// if other condition, then set the condition at false:
If Setup AND L < L[1] AND H > H[1] {outside bar; substitue by what you want} then begin
Setup = false;
end;
// if 12 bars have elapsed, then set the condition at false:
If Setup AND BarNumber >= SetupBarNumber + 12 then begin
Setup = false;
end;
Another way would be to identify how many bars ago the condition was true (with a function like "MRO"), check that it occurred less than 12 bars ago, and check that no trade was done between this most recent time the condition was true and now.
This was definetly an issue and multicharts support confirmed what i was originally saying. They (Henery) at multicharts support after testing verified it and gave me a hot fix as other people were having and issue with it also. The future versions of multicharts will have this flaw/bug removed they told me.
Nicolas11
I still not succeed in reproducing your problem.
I have used the following signal in real-time sim mode, connected to my broker (Interactive Brokers).
Instrument is EUR.USD.
Timeframe is 1 minute.
The "condition" becomes true a few minutes after the activation of the strategy.
But the entry is impossible (the required entry price is set @ 1000 ticks above current price).
[IntraBarOrderGeneration = false]
Variables:
TickSize ( MinMove / PriceScale ),
NbContracts ( 10000 ),
NotAlreadyDone ( true );
if Date = 1120131 AND Time >= 1313 AND NotAlreadyDone {to be sure the test will be done only once} AND MarketPosition = 0 then begin
Buy ("Entry LONG") NbContracts contracts next bar at H + 1000 * TickSize or higher {virtually impossible};
NotAlreadyDone = false;
end;
if MarketPosition = 1 AND BarsSinceEntry >= 1 then
Sell ("Time Exit LONG") next bar at market; // actually never used since no entry triggered
MultiCharts has generated the buy order. This order could not be executed since the required price was too high. After one minute, the order has been automatically cancelled by MultiCharts. Evidence in MC's "Order Position Tracking window" with the "Cancelled" status:
Same behaviour (order then cancellation of the order) has been noticed in the broker's software, not shown here.
3. Is there any 'best practises' when using limit orders?
Yes there is:
Buy Stop and Sell Stop orders... 99% of the time, I would say 100% of the time you will get filled.
If you are using Limits Orders most likely you will not get filled, mainly if price is moving fast or there is a spike; Limits Orders never worked for me.
Now, after I am in a position then I use Limit Orders to take some profits [Sell Limit and But Limit], but for entries ONLY Buy Stop and Sell Stop.
I am will MB Trading as well and the majority of the time they did not fill my Limits Orders, it was really really really frustrating. Like a trade that could have made me some nice profit...
They say: We pay for Limits!!! Pfff... who cares you pay for Limits Orders, once your orders won't get fill anyway.
About your 20 pips slippage, I trade with MB for a while now and I never seen that, however one day I had 12 pip slippage on the AUD/USD I call them immediately: They say it was a news event and then I say that there are news event every single day and please never do that again.
I recommend issuing orders at the bid/ask and applying some sort of momentum cushion.
In high velocity markets, your limit order can get skipped if you try to issue at an open price.
inputs: pricegap(.01);
If (entry criteria) then buy next bar at currentask + pricegap;
If (entry criteria) then sellshort next bar at currentbid - pricegap;
etc.
you can also make pricegap a variable that adjusts according to the market volitility/velocity. In higher velocity markets, it can be larger and it slow markets, you can have it converge to zero.
It was good but then it is difficult to keep it aligned with the MC. In MC orders only post them on Data1 and for BID and ASK you have to put even Data2. How could we do?
You could try to put two charts in the WS ....
We can also add the sort of excursion of the time, where the pricegap becomes greater if the time grows, the less if it goes down, just that this is above my current abilities.
Any suggestion?
vars:mystoploss(0);
condition1= h<h[1] and l>l[1];
if marketposition = 0 and condition1 then
buy ("IB Break") 1 contracts next bar at h+1 point or higher;
setprofittarget(500);
setstoploss(500);
Nicolas11
Hi,
I do not succeed in reproducing your problem.
I have applied your signal on EUR.USD 5 min:
// EUR.USD
Condition1 = H < H[1] and L > L[1];
if MarketPosition = 0 and Condition1 then
buy ("IB Break") 1 contracts next bar at H+1 point or higher;
SetProfitTarget(0.0005);
SetStopLoss(0.0005);
I have also added an indicator to show the IB which are not triggered on the following bar:
Condition1 = H < H[1] and L > L[1];
if Condition1[1] AND H <= H[1] then begin
Value1 = Arw_New(Date, Time, High+0.0003, true);
Arw_SetText(Value1, "IB but no trigger");
end;
The results (backtesting) are as expected: when an IB does not trigger an order, such order is "forgotten" after the bar elapsed:
Nicolas
I think, but probably I am wrong that code is wrong.
In your code if you work with 1 lot = 100.000
0.0005 is equal to 50 $ and not 500$
Nicolas the time frame should be 1 hours and not 5 minutes.
Guppy use a monetary stop e target of 500$ so the set should change.
I think that you should write 0.0050, nut is bettter use 500 no avoid mistakes.
I use tradestation and for default the minim lot size is minilot = 10.000 so
0.0005 = 5$.
If we trade FX eurusd and we want trade 10.000 eurs or 1 minilot it should be
//
// EUR.USD
input: SPT(500), SSL(500), cts(10000);
Condition1 = H < H[1] and L > L[1];
if MarketPosition = 0 and Condition1 then
buy ("IB Break") cts contracts next bar at H + 0.0001 stop ;
SetProfitTarget(SPT);
SetStopLoss(SSL);
In the following image i post charts, the time frame is daily because the value of
SetProfitTarget(SPT);
SetStopLoss(SSL);
=500 is to big and trade is executed at 1 hour time frame.