Shorting instead of selling - page 2

 
JTWrenn:

Here is all my code though just in case anyone feels like telling me I am wrong on anything:) Greatly appreciate any advice especially on the slippage, stoploss, and take profit ideas.

It's the previous bar not the previous tick . . .

SlowLast=iMA(NULL,0, Slow_Period, Slow_Shift,Slow_Method, Slow_Price, 1); // Pulls current slow avg from previous tick
FastLast=iMA(NULL,0, Fast_Period, Fast_Shift,Fast_Method, Fast_Price, 1); // Pulls current fast avg from previous tick

Don't comment it out . . . do more of it . . .

//if(ticket<0)
// {
// Print("OrderSend failed with error: ",GetLastError());
// return(0);
// }

Read this: What are Function return values ? How do I use them ?

 
Thanks Raptor will do as much of the above as I can.
 
alladir:

slippage is something I did a bit of studying on recently.. turns out for most of my brokers, it doesn't matter what figure you input.. it still accepts the order at any slippage.

Also, check if your broker is ECN. If so, you can't set stops in the initial OrderSend. You need to send the order then use OrderModify to set stops.

I'm not going to error check your code, but all in all, I would never risk money with code that fits on a page... it's sensible to have a lot of error checking at every stage, with a course of action for every possible thing that could go wrong.

Give it a go with a demo account!


Thanks for the comment, and yeah this is really just my learner thing trying to figure things out and poke around. Trying really simple stuff at first then build on top while I learn the language and thought process. Thanks for the ECN idea will give it a look.