Im trying to implement the triple order MM script (posted in the script section here) into a trend line trading semiauto EA. the order send function is working perfectly but I've tried lots of things and can't seem to get the order modify functions to work for SL and TP.
Do I have to do things differently when modifying orders for a pair other than what chart the EA is loaded onto? Or should I just keep trying to make it work?
Order modify question
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Order modify question
When accessing a non-chart pair, you can't use things like Bid and Ask, Point, etc. You have to look up everything with MarketInfo(). Post your code and we can give it a look.mlewis wrote:Im trying to implement the triple order MM script (posted in the script section here) into a trend line trading semiauto EA. the order send function is working perfectly but I've tried lots of things and can't seem to get the order modify functions to work for SL and TP.
Do I have to do things differently when modifying orders for a pair other than what chart the EA is loaded onto? Or should I just keep trying to make it work?
George
- mlewis
- Trader
- Posts: 76
- Joined: Wed Mar 21, 2012 1:51 pm
- Location: London
Re: Order modify question
George... thank you so much for taking the time to do this!! You're a true gentleman!
You will need to place these onto an AUDJPY chart. I use H1 but it doesn't matter really.
You dont need the indicator for the EA to work but you do need to know where the close of the current candle is for the index that the indicator draws in order to place the trendlines, as this will be a different price to the current close of the pair that the EA is attached to. Eventually i will get around to working out how to get the EA to draw the index chart but i don't want to add too many layers of confusion at this stage.
To place an order simply draw a trendline and name it "sl" for sell limit. when the close of the index is above the line it sends the tripple order.
I haven't implimented any of the other order types yet so don't try to place buy limits, sell stops or buy stops.
I use an ECN broker so can't wrap the stop loss / take profit info up into the ordersend.
kind regards
ML
You will need to place these onto an AUDJPY chart. I use H1 but it doesn't matter really.
You dont need the indicator for the EA to work but you do need to know where the close of the current candle is for the index that the indicator draws in order to place the trendlines, as this will be a different price to the current close of the pair that the EA is attached to. Eventually i will get around to working out how to get the EA to draw the index chart but i don't want to add too many layers of confusion at this stage.
To place an order simply draw a trendline and name it "sl" for sell limit. when the close of the index is above the line it sends the tripple order.
I haven't implimented any of the other order types yet so don't try to place buy limits, sell stops or buy stops.
I use an ECN broker so can't wrap the stop loss / take profit info up into the ordersend.
kind regards
ML
You do not have the required permissions to view the files attached to this post.
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Order modify question
What error messages are you getting?mlewis wrote:George... thank you so much for taking the time to do this!! You're a true gentleman!
You will need to place these onto an AUDJPY chart. I use H1 but it doesn't matter really.
You dont need the indicator for the EA to work but you do need to know where the close of the current candle is for the index that the indicator draws in order to place the trendlines, as this will be a different price to the current close of the pair that the EA is attached to. Eventually i will get around to working out how to get the EA to draw the index chart but i don't want to add too many layers of confusion at this stage.
To place an order simply draw a trendline and name it "sl" for sell limit. when the close of the index is above the line it sends the tripple order.
I haven't implimented any of the other order types yet so don't try to place buy limits, sell stops or buy stops.
I use an ECN criminal so can't wrap the stop loss / take profit info up into the ordersend.
kind regards
ML
George
- mlewis
- Trader
- Posts: 76
- Joined: Wed Mar 21, 2012 1:51 pm
- Location: London
Re: Order modify question
Well, I've done various incarnations of this, using various types of orderselect and ordermodify. The most common error was "ordermodify failed with error 'no error' " or simply no error message but no stoploss or Break even. I'll have to wait until the market is open again as I had removed the ordermodify from the EA so I had to reconstructed what I has been trying to post here to give you an idea of what I had tried.
I'm slightly suspicious that my bracketing is a bit out of control and that if the ordermodify was included into a different loop then it might spring into life. Possible perhaps?
It's hard to test when the market is closed though since every incarnation has always compiled without errors or warnings...
ML
I'm slightly suspicious that my bracketing is a bit out of control and that if the ordermodify was included into a different loop then it might spring into life. Possible perhaps?
It's hard to test when the market is closed though since every incarnation has always compiled without errors or warnings...
ML
- mlewis
- Trader
- Posts: 76
- Joined: Wed Mar 21, 2012 1:51 pm
- Location: London
Re: Order modify question
yep... it places all of the orders correctly, but with SL and TP set to 0.00000, then display three error alerts:
Stoploss/Takeprofit 1 OrderModify failed with error No Error
Stoploss/Takeprofit 2 OrderModify failed with error No Error
Stoploss/Takeprofit 3 OrderModify failed with error No Error
ML
Stoploss/Takeprofit 1 OrderModify failed with error No Error
Stoploss/Takeprofit 2 OrderModify failed with error No Error
Stoploss/Takeprofit 3 OrderModify failed with error No Error
ML
- mlewis
- Trader
- Posts: 76
- Joined: Wed Mar 21, 2012 1:51 pm
- Location: London
Re: Order modify question
aha!!!! i might have worked it out!! in the experts messages it says :
MJL Risk Index Semi-Auto Trader AUDJPY, H1, invalid TakeProfit for ORDERMODIFY function
so clearly the Ordermodify is not in the form that it wants.
ML
MJL Risk Index Semi-Auto Trader AUDJPY, H1, invalid TakeProfit for ORDERMODIFY function
so clearly the Ordermodify is not in the form that it wants.
ML
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Order modify question
Go ahead and add an Alert() to print out the values of the temp_stoploss and temp_takeprofit1 to make sure they look like what you expect.mlewis wrote:aha!!!! i might have worked it out!! in the experts messages it says :
MJL Risk Index Semi-Auto Trader AUDJPY, H1, invalid TakeProfit for ORDERMODIFY function
so clearly the Ordermodify is not in the form that it wants.
ML
George
- mlewis
- Trader
- Posts: 76
- Joined: Wed Mar 21, 2012 1:51 pm
- Location: London
Re: Order modify question
YES!!!! i worked it out!!
i needed to do this otherwise the amount i was adding and subtracting to the OpenOrderPrice was in pips rather than as the actual price so was orders of magnitude too big.
SL_Short_Price = StopLossShort*PointShort;
TP1_Short_Price = TakeProfitShort1*PointShort;
TP2_Short_Price = TakeProfitShort2*PointShort;
TP3_Short_Price = TakeProfitShort3*PointShort;
SL_Long_Price = StopLossShort*PointShort;
TP1_Long_Price = TakeProfitShort1*PointShort;
TP2_Long_Price = TakeProfitShort2*PointShort;
TP3_Long_Price = TakeProfitShort3*PointShort;
George, i really appreciate your kind offer to help out, It's the people whole roll up their sleves to help others out on a furum like this that really make the whole thing function as a community.
Thank You!
i needed to do this otherwise the amount i was adding and subtracting to the OpenOrderPrice was in pips rather than as the actual price so was orders of magnitude too big.
SL_Short_Price = StopLossShort*PointShort;
TP1_Short_Price = TakeProfitShort1*PointShort;
TP2_Short_Price = TakeProfitShort2*PointShort;
TP3_Short_Price = TakeProfitShort3*PointShort;
SL_Long_Price = StopLossShort*PointShort;
TP1_Long_Price = TakeProfitShort1*PointShort;
TP2_Long_Price = TakeProfitShort2*PointShort;
TP3_Long_Price = TakeProfitShort3*PointShort;
George, i really appreciate your kind offer to help out, It's the people whole roll up their sleves to help others out on a furum like this that really make the whole thing function as a community.
Thank You!
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Order modify question
Glad it worked out!mlewis wrote:YES!!!! i worked it out!!
i needed to do this otherwise the amount i was adding and subtracting to the OpenOrderPrice was in pips rather than as the actual price so was orders of magnitude too big.
SL_Short_Price = StopLossShort*PointShort;
TP1_Short_Price = TakeProfitShort1*PointShort;
TP2_Short_Price = TakeProfitShort2*PointShort;
TP3_Short_Price = TakeProfitShort3*PointShort;
SL_Long_Price = StopLossShort*PointShort;
TP1_Long_Price = TakeProfitShort1*PointShort;
TP2_Long_Price = TakeProfitShort2*PointShort;
TP3_Long_Price = TakeProfitShort3*PointShort;
George, i really appreciate your kind offer to help out, It's the people whole roll up their sleves to help others out on a furum like this that really make the whole thing function as a community.
Thank You!
George