Buy / Sell Code Problem - futures io
futures io



Buy / Sell Code Problem


Discussion in Platforms and Indicators

Updated
    1. trending_up 1,565 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

Buy / Sell Code Problem

(login for full post details)
  #1 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
 
Posts: 64 since Oct 2012
Thanks: 112 given, 34 received

Hello,

I have learned a great deal from this site over the past few weeks but unfortunately still feel dwarfed by the amount of knowledge I find here. Not only feel embarrassed to answer a question but more so to ask one. Any way here it is :

Below is my buy / sell code ( based on John Ehlers Center of Gravity Indicator ) Something is just not right; it buys and sells OK but I can't test it in the strategy tester...all results come back insignificant. Any help is much appreciated.

//************GO LONG

if ( (iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 1) > iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 2, 1) && iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 3) > iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 0, 3)) )
{ Print("Trading condition [(iCustom(Symbol(), 0, Center Of Gravity Oscillator...] is valid. Trying to open long position...");
Buy(Symbol(), 0.01, 30, 15, 15); }

//************EXIT LONG

if ( (iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 1) < iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 2, 1) && iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 3) < iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 0, 3)) )
{ Print("Trading condition [(iCustom(Symbol(), 0, Center Of Gravity Oscillator...] is valid. Trying to close long position...");
CloseLong(Symbol()); }

//************GO SHORT

if ( (iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 1) < iCustom(Symbol(), 1, "Center Of Gravity Oscillator",8,true, 2, 1) && iCustom(Symbol(), 1, "Center Of Gravity Oscillator",8,true, 0, 3) < iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 0, 3)) )
{ Print("Trading condition [(iCustom(Symbol(), 0, Center Of Gravity Oscillator...] is valid. Trying to open long position...");
Sell(Symbol(), 0.01, 30, 15, 15); }

//************EXIT SHORT

if ( (iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 1, 1) > iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 2, 1) && iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 0, 3) > iCustom(Symbol(), 0, "Center Of Gravity Oscillator",8,true, 0, 3)) )
{ Print("Trading condition [(iCustom(Symbol(), 0, Center Of Gravity Oscillator...] is valid. Trying to close short position...");
CloseShort(Symbol()); }

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Does it affect the long run performance if I forcibly cl …
Emini and Emicro Index
Experience with AGN (Introducing Broker)
Brokers
Help with NinjaScript strategy keyboard event
NinjaTrader
Portfolio Management Tool/Software
Psychology and Money Management
Time Segmented Volume
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Al Brooks Trading Course (www.brookstradingcourse.com)
29 thanks
Fail to Plan - Plan to Fail: What can go wrong?
22 thanks
Losing faith...
21 thanks
Where do you get your financial news & investment ideas?
18 thanks
Holding futures overnight
17 thanks
 
(login for full post details)
  #2 (permalink)
 NJAMC 
Atkinson, NH USA
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,970 since Dec 2010
Thanks: 3,036 given, 2,379 received


resirca52009 View Post
Hello,


Below is my buy / sell code ( based on John Ehlers Center of Gravity Indicator ) Something is just not right; it buys and sells OK but I can't test it in the strategy tester...all results come back insignificant. Any help is much appreciated.

Hi @resirca52009,

Is it possible that indicator needs TickData? If so, you can probably only test it under Replay mode. Back testing and strategy testing only provides bar data, not tick data, back to the strategy.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to NJAMC for this post:
 
(login for full post details)
  #3 (permalink)
 NJAMC 
Atkinson, NH USA
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,970 since Dec 2010
Thanks: 3,036 given, 2,379 received


Sorry,

I am not sure my message above is relevant, I don't know anything about MetaTrader, I was thinking the question was about NinjaTrader.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #4 (permalink)
 resirca52009 
Indianapolis, Indiana/ USA
 
Experience: Advanced
Platform: MT4, Ninjatrader
Broker: AMP / CQG
Trading: Futures
 
Posts: 64 since Oct 2012
Thanks: 112 given, 34 received


NJAMC View Post
Hi @resirca52009,

Is it possible that indicator needs TickData? If so, you can probably only test it under Replay mode. Back testing and strategy testing only provides bar data, not tick data, back to the strategy.

NJAMC,

Thanks for the reply & links; I'll review it.......

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators > Buy / Sell Code Problem


Last Updated on November 12, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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